-
Notifications
You must be signed in to change notification settings - Fork 969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
middleware::map_request[_with_state[_arc]]
and map_response[_with_state[_arc]]
#1394
Comments
I think that makes sense to support. I'm a bit worried about duplicating stuff that is in tower but I think these two are probably fine. |
middleware::map_request[_with_state[_arc]]
and map_response[_with_state[_arc]]
Well, ours are going to be more ergonomic by supporting extractors. |
Oh yeah that's right! |
I've been discussing this a bit with @genusistimelord, one question that came up is what the function signature should look like, in particular for The easy way out of this is providing both |
Can you elaborate? That's pretty much just a different way of spelling the same thing (w/ some different rules for |
I think a map_request* and try_map_request* make the most sense here as we can dictate that map_request never fails and try Can fail returning a |
I was thinking something like #1408 |
Feature Request
Motivation
axum
sfrom_fn[_with_state[_arc]]
can be confusing to newcomers who haven't read about / fully understood tower's "onion principle" of layers yet. Its generality also makes for a little more boilerplate than necessary when one wants to write a middleware that only concerns itself with either the request or response.Proposal
Add
map_request[_with_state[_arc]]
andmap_response[_with_state[_arc]]
to themiddleware
module. In the case ofmap_response*
it is notable that async functions passed to these functions will never have to be generic.Alternatives
Do nothing.
The text was updated successfully, but these errors were encountered: