Skip to content

Commit 1f43b55

Browse files
authored
Merge pull request #927 from prnvbn/patch-1
Fix code samples in the response output documentation
2 parents c7a8a79 + 15d131a commit 1f43b55

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docs/docs/features/response-outputs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ huma.Register(api, huma.Operation{
2626
}, func(ctx context.Context, input ThingRequest) (*struct{}, error) {
2727
// Do nothing...
2828
return nil, nil
29-
}
29+
})
3030
```
3131

3232
If the response code needs to be **dynamic**, you can use the special `Status` field in your response struct. This is not recommended, but is available if needed.
@@ -41,7 +41,7 @@ huma.Register(api, huma.Operation{
4141
Method: http.MethodGet,
4242
Path: "/things/{thing-id}",
4343
Summary: "Get a thing by ID",
44-
}, func(ctx context.Context, input ThingRequest) (*struct{}, error) {
44+
}, func(ctx context.Context, input *ThingRequest) (*ThingResponse, error) {
4545
// Create a response and set the dynamic status
4646
resp := &ThingResponse{}
4747
if input.ID < 500 {
@@ -51,7 +51,7 @@ huma.Register(api, huma.Operation{
5151
resp.Status = 250
5252
}
5353
return resp, nil
54-
}
54+
})
5555
```
5656

5757
!!! info "Dynamic Status"
@@ -115,7 +115,7 @@ huma.Register(api, huma.Operation{
115115
},
116116
}
117117
return resp, nil
118-
}
118+
})
119119
```
120120

121121
You can set multiple cookies by using a slice like `[]http.Cookie` instead.

0 commit comments

Comments
 (0)