-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add map_response
and friends
#1414
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
Conversation
impl<F, Fut, S, I, B, ResBody, $($ty,)*> Service<Request<B>> for MapResponse<F, S, I, ($($ty,)*)> | ||
where | ||
F: FnMut($($ty,)* Response<ResBody>) -> Fut + Clone + Send + 'static, | ||
$( $ty: FromRequestParts<S> + Send, )* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we require FromRequestParts
and not FromRequest
. Not sure there would be a way to recover the request afterwards so we can pass it to the inner service 🤔
If users need the request body in a map_response
I think a full from_fn
might be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is exactly right IMO.
impl<F, Fut, S, I, B, ResBody, $($ty,)*> Service<Request<B>> for MapResponse<F, S, I, ($($ty,)*)> | ||
where | ||
F: FnMut($($ty,)* Response<ResBody>) -> Fut + Clone + Send + 'static, | ||
$( $ty: FromRequestParts<S> + Send, )* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is exactly right IMO.
Oh, you had enabled auto-merge. Well, docs can still be improved separately :) |
🚀 😅 I'll do a follow-up |
Part of #1394