MockHttpServletRequestBuilder does not allow invalid content type for testing [SPR-17643] #22172
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: superseded
An issue that has been superseded by another
type: enhancement
A general enhancement
dmitry87 opened SPR-17643 and commented
One of the app in stack sends invalid content type. Currently it is impossible to cover this in Unit test because
MockHttpServletRequestBuilder
uses MediaType.parse(contentType: String).toString() to get the value and it fails to get to ExceptionHandlerI propose that
MockHttpServletRequestBuilder
could accept any string for contentType. In this case when we send payload with invalid(unparsable) contentType to our controller we will handle InvalidMediaTypeException with our exception handler in Unit testsAffects: 5.1.3
Referenced from: pull request #2077
The text was updated successfully, but these errors were encountered: