MockMvcClientHttpRequestFactory swallows ServletResponse.errorMessage #26720
Closed
Description
If there was an error while processing a request, MockHttpServletResponse.sendError(int status, String errorMessage)
only sets this.errorMessage
and does not write to this.content
. Conversely, MockMvcClientHttpRequestFactory only reads servletResponse.content
and ignores the error message.
This results in error response bodies being swallowed in mockMVC tests which use RestTemplate
with MockMvcClientHttpRequestFactory
.
So, either MockHttpServletResponse.sendError() should write to the outputstream or MockMvcClientHttpRequestFactory should read something like "errorMessage or if null the content byte array".
Activity