-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Breaking change from 6.0.11 to 6.0.12 if you expect query parameters in @RequestBody
#31327
Comments
Thanks for the sample. Spring Boot 3.1.4 upgraded the managed version of Spring Framework to from 6.0.11 to 6.0.12. With your sample, leaving the Spring Boot version at 3.1.3 and adding |
Thank you for that clarification. I suspected the change might be in Spring Framework itself. Do you want me to move the issue? |
We can take care of moving the issue. |
This appears to be a regression as a result of #30942. We have logic for form data that reconstructs the request body from request parameters. This is to ensure consistent access to form data even if some code tries to access request parameters (e.g. from a Filter) which would cause the Servlet container to parse the body. The change in the referenced PR now relies on the Content-Length which in this scenario is 0. Is your actual scenario sending a form data request with just a query and no body? |
I just had a test that did something wrong, and I have fixed that. My purpose with this issue was just to raise the awareness of this changed behavior, as it COULD be a breaking change for someone else. For me it would be no problem if you closed this, because the breaking change was only if developers (potentially external clients) did something really wrong in the first place. :-) |
@RequestBody
We've decided to undo the optimization from #30942 for 6.0.13, while for 6.1 we'll avoid reconstructing the body from request parameters, if the query string is not null. |
This allows restoring optimization in StringHttpMessageConverter that was undone in 23162b for 6.0.x. Closes gh-31327
This also broke my application. |
I discovered a breaking change between Spring Boot 3.1.3 and 3.1.4. It only affects users that are doing something wrong (imho), but as I discovered it in a test, maybe others have done the same mistake.
I have replicated it here: https://github.com/anderius/spring-requestbody-demo
The tests passes with Spring Boot 3.1.3, but change that to 3.1.4, and the test fails.
It seems query parameters was previously put into a parameter annotated with
@RequestBody
, but that changed in 3.1.4. The new behavior is the correct one, I believe.Relevant code snippets:
The text was updated successfully, but these errors were encountered: