Skip to content

Regression: @RequestBody(required = false) not respected [SPR-13417] #17996

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jean-Baptiste Nizet opened SPR-13417 and commented

I'm migrating from 4.1.2 to 4.2.1, and am observing a regression.
A RestController method annotated with @RequestMapping(method = POST) and having an argument annotated with @RequestBody(required = false) causes a 415 response to be sent back by Spring MVC if the request doesn't have a body.

This used to work. And the behavior contradicts the javadoc of RequestBody.
BTW, a similar bug used to exist, and had been fixed: #14575.


Affects: 4.2.1

Issue Links:

Referenced from: commits spring-attic/spring-framework-issues@6bdf345, spring-attic/spring-framework-issues@fb75c0d

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions