Skip to content
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

Re-allow handling empty request body [SPR-12778] #17376

Closed
spring-issuemaster opened this issue Mar 3, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Mar 3, 2015

Oliver Drotbohm opened SPR-12778 and commented

In case a request contains an empty body, Spring 4.1's RequestResponseBodyMethodProcessor calls handleEmptyBody(…) and immediately returns null without further consideration of HandlerMethodArgumentResolver instances that might be able to deal with an empty request body.

This is a regression in cases where the HandlerMethodArgumentResolver was explicitly designed to return a default value, which worked fine with 4.0.x.


Affects: 4.1.5

Issue Links:

  • #16447 Contract of @RequestBody(required=true) not obeyed
  • #16766 ResponseBodyAdvice to accept null values?
  • DATAREST-485 RepositoryPropertyReferenceController.createPropertyReference(…) does not work for empty content supplied on Spring 4.1
  • #18434 Spring Controller is not able to detect empty string ("") as a string object in RequestBody
  • #17458 Contract of @RequestPart(required=false) not obeyed
  • #17459 HttpEntity controller method arguments should allow null body
  • #17605 Commons FileUpload failed after Spring framework upgrade

0 votes, 5 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 3, 2015

Juergen Hoeller commented

On a related note, #16766 suggested a softer landing for null return values, letting them go through ResponseBodyAdvice for the purpose of turning it into a default value. That use case seems similar to the present one, since this issue is essentially about passing a null request body to converters for the purpose of returning a default value.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 17, 2015

Juergen Hoeller commented

Since this more or less worked accidentally before, we're trying to provide a proper solution for the problem in 4.2, not messing with the behavior in the 4.1.x line anymore (since any change might be a regression for somebody).

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 29, 2015

Rossen Stoyanchev commented

Commits 0556ed and 36ed4d introduce RequestBodyAdvice and provide it full control over the handling of an empty request body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.