Skip to content

Commit

Permalink
feat(http): support for custom http response status codes (#450)
Browse files Browse the repository at this point in the history
Co-authored-by: Miłosz Smółka <milosz.smolka@gmail.com>
  • Loading branch information
thejoeejoee and m110 authored Jun 27, 2024
1 parent 68e9c20 commit 87f8688
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/content/pubsubs/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,12 @@ httpSubscriber.StartHTTPServer()
{{% load-snippet-partial file="src-link/watermill-http/pkg/http/subscriber.go" first_line_contains="// Subscribe adds" last_line_contains="func (s *Subscriber) Subscribe" %}}
{{% /render-md %}}

##### Custom HTTP status codes

To specify a custom HTTP status code, which will returned as response, you can use following call during message handling:

{{< highlight >}}
// msg is a *message.Message
http.SetResponseStatusCode(msg, http.StatusForbidden)
msg.Nack()
{{< /highlight >}}

0 comments on commit 87f8688

Please sign in to comment.