You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MockServletRequest and MockServletResponse need to support Content-Type so that tests that depend on that header value can yield the appropriate results. I do not know if other headers are ignored as well.
Note that 'Content-Type' may also include a character encoding, which means the contentType, the characterEncoding fields, and the 'Content-Type' header need to be kept in sync regardless of which one is updated and in what order.
My initial approach did just that. However, I've reconsidered since it would break existing tests, which rely on contentType and characterEncoding being equal to exactly what they were set to.
The contentType field and the 'Content-Type' header should now be "text/plain;charset=UTF-8". Existing tests will break because they expect contentType to be "text/plain".
To avoid breaking existing tests, contentType and characterEncoding continue to be equal to exactly what they were set to while the 'Content-Type' header is set correctly. Or if the 'Content-Type' header is set, the contentType and the characterEncoding fields will be set accordingly. I think this will provide the desired behavior without breaking existing tests.
Neil Chaudhuri opened SPR-8750 and commented
MockServletRequest and MockServletResponse need to support Content-Type so that tests that depend on that header value can yield the appropriate results. I do not know if other headers are ignored as well.
Affects: 3.0.6
Reference URL: http://forum.springsource.org/showthread.php?115547-Testing-HttpRequestHandlingMessagingGateway-with-MockHttpServletRequest-PUT
Referenced from: commits 63e235f, 7918810
The text was updated successfully, but these errors were encountered: