How to get huma.Context from context.Context #410
-
|
When I create a handler using huma.Register the handler signature is How do I get the the huma.Context from that |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
You can pass it via context from middleware, but it against huma design principle, so no builtin way to do this. |
Beta Was this translation helpful? Give feedback.
-
|
@davidolrik what are you trying to accomplish using the |
Beta Was this translation helpful? Give feedback.
What I did, was creating a small middleware that added the client ip from request to the context like this:
You can then access the client ip in your request handlers like so:
If you need access to the whole request, then just put
rin to the context