Skip to content

How do I read and mutate the HttpResponse<B> in a Service<ServiceRequest> middleware? #3048

Answered by robjtede
jsoneaday asked this question in Q&A
Discussion options

You must be logged in to vote

Firstly, using EitherBody is the right solution here, following a similar pattern to this case from the examples repo.

Check out the docs for poll_next to see what should be returned. In this case, you have an infinite loop because you never return Ok(None).

Though, I'd advise against using a custom impl here, since String implements MessageBody already.

Replies: 7 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jsoneaday
Comment options

Comment options

You must be logged in to vote
1 reply
@robjtede
Comment options

Answer selected by robjtede
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants