-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix Error handler rebinding the body #548
Conversation
When we read the body for a request, and then try to re-read it for a different Body type in an error handler, we fail as the stream is already exhausted This PR caches the input-stream and re-sets it whenever the input-stream is re-required Also updated micronaut core, reactor and undertow
this change has severe performance implications. is it necessary? netty does not do this. |
At the minimum, we must document that rebinding to a different type does not work. |
This reverts commit ba893a5.
@yawkat The ServletBodyBinder reads the request body from getInputStream. This fails as the body is invalid json But then the error handler tries to read the body as a String, so it goes back through the servletbodybinder and fails. I'm not sure how netty does it, I assume it's working on buffers instead of inputstreams... @sdelamo I am happy with this being a simple documentation change instead of this caching of all request bodys |
netty only buffers for json. imo modifying getInputStream to always buffer is not worth it. there are plenty of (non-json) streaming use cases where buffering may be prohibitive. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Ok, added docs around known issues with servlet and ignored the test in the TCKs |
When we read the body for a request, and then try to re-read it for a different Body type in an error handler, we fail as the stream is already exhausted
This PR caches the input-stream and re-sets it whenever the input-stream is re-required
Also updated micronaut core, reactor and undertow