Closed
Description
elliot barlas opened SPR-9603 and commented
The handleNoMatch method of the RequestMappingInfoHandlerMapping class incorrectly throws HttpRequestMethodNotSupportedException if:
- A request handler method exists that matches the path and methods but not produce/consume expression
- Another request handler method exists that matches the path but not the method
In this case, the handleNoMatch method finds the request handler method that matches the path but not the method, resulting in a HttpRequestMethodNotSupportedException (line 135).
Example:
Request sent for "/users" with "Accept: application/xml"
@RequestMapping(value = "/users", method = GET, produces = "application/json")
public void foo() {...}
@RequestMapping(value = "/users", method = PUT)
public void bar() {...}
Expected exception HttpMediaTypeNotAcceptableException, observed exception HttpRequestMethodNotSupportedException.
Affects: 3.1 GA
Issue Links:
- RequestMappingInfoHandlerMapping.handleNoMatch throws 415 when it should throw 406 [SPR-14397] #18969 RequestMappingInfoHandlerMapping.handleNoMatch throws 415 when it should throw 406