Closed danielgtaylor closed 4 months ago
The recent changes introduce a new method RemoteAddr()
to various context structs across multiple files. This method allows retrieving the remote address of the client making the request. Additionally, the RemoteAddr()
method has been added to the Context
interface, ensuring a consistent way to access the client's remote address across different implementations.
Files | Change Summary |
---|---|
adapters/humabunrouter/humabunrouter.go |
Added RemoteAddr() method to bunContext and bunCompatContext structs. |
adapters/humachi/humachi.go |
Added RemoteAddr() method to chiContext struct. |
adapters/humaecho/humaecho.go |
Added RemoteAddr() method to echoCtx struct. |
adapters/humafiber/humafiber.go |
Added RemoteAddr() method to fiberCtx struct. |
adapters/humaflow/humaflow.go |
Added RemoteAddr() method to goContext struct. |
adapters/humagin/humagin.go |
Added RemoteAddr() method to ginCtx struct. |
adapters/humago/humago.go |
Added RemoteAddr() method to goContext struct. |
adapters/humahttprouter/humahttprouter.go |
Added RemoteAddr() method to httprouterContext struct. |
adapters/humamux/humamux.go |
Added RemoteAddr() method to gmuxContext struct. |
api.go |
Added RemoteAddr() method to the Context interface, allowing all context implementations to retrieve the client’s remote address. |
Objective | Addressed | Explanation |
---|---|---|
Provide a way to get the client's remote address from huma.Context (#445) |
✅ |
In the world of code, where bytes do race,
A rabbit hops with gentle grace.
Remote addresses now in sight,
Contexts gleam with newfound light.
From bun to mux, the change is clear,
The client's path is now held dear.
With every hop, the code's delight! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.77%. Comparing base (
1b6a3e5
) to head (48c4d1a
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Based on several user requests, this adds access to the remote address from the client request to the Huma context so you can use it in middleware and resolvers.
Fixes #445.
Summary by CodeRabbit
RemoteAddr()
method to theContext
interface, enhancing the ability to access the client's remote address.