From fc3ce51e58be85ceb90af3c5a3c2bacfe7ef0f9b Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Sun, 7 Apr 2024 21:32:01 -0700 Subject: [PATCH] docs: fix middleware header example --- docs/docs/features/middleware.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/docs/features/middleware.md b/docs/docs/features/middleware.md index 54544b7c..0c3ccda6 100644 --- a/docs/docs/features/middleware.md +++ b/docs/docs/features/middleware.md @@ -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 {