Skip to content

Commit

Permalink
Merge pull request #358 from danielgtaylor/fix-middleware-header-example
Browse files Browse the repository at this point in the history
docs: fix middleware header example
  • Loading branch information
danielgtaylor authored Apr 8, 2024
2 parents 9cf7dfa + fc3ce51 commit 6247e82
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/docs/features/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ Example:

```go title="code.go"
func MyMiddleware(ctx huma.Context, next func(huma.Context)) {
// Set a custom header on the response.
ctx.SetHeader("My-Custom-Header", "Hello, world!")

// Call the next middleware in the chain. This eventually calls the
// operation handler as well.
next(ctx)

// Set a custom header on the response *after* the operation handler
// has finished.
ctx.SetHeader("My-Custom-Header", "Hello, world!")
}

func NewHumaAPI() huma.API {
Expand Down

0 comments on commit 6247e82

Please sign in to comment.