-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Cannot read request body in middleware #373
Comments
I think you should use req.body().concat2().and_then(..) or something like that |
The problem is, that the current version on crates.io will take ownership of a request, when calling Cloning the request before calling the methods of Stream or Future will result in an empty body. |
you can clone request, but if you read body in middleware, handle won't be able to get body, you would need to pass body from middleware to handler somehow. if you need to verify body, you have to combine verification with handling. |
I think I am at the same point. I want to send parts of the request out of the middleware to validate them. Currently I am able to extract the parts by using a String
I am very thankful for some kind of hint. |
I think the problem is that Everything is fine with your I guess you may need to clone Feel free to join gitter for some real-time Q&A 😄 |
I'm trying to validate a request by calculating the HMAC over the body and comparing against a value passed as an HTTP header. I'm trying to do this using a middleware:
This will fail after the call to
read_to_end
withError occured during request handling, status: 500 Internal Server Error Not ready
. It seems likeread_to_end
does not block to wait for the future being finished. What would be the correct way, to get the request body as aVec<u8>
or&[u8]
?The text was updated successfully, but these errors were encountered: