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
Using Spring 4.1.8.RELEASE, testing a controller method with a response.setIntHeader('Content-length', 5) throws the following Exception
java.lang.Integer cannot be cast to java.lang.String
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at org.springframework.mock.web.MockHttpServletResponse.setSpecialHeader(MockHttpServletResponse.java:513)
As it seems to be a valid use case to manually set a Content-length header with an integer, the cast of the Object value to String type inside the setSpecialHeader method should be conditional.
I have supplied a referenceURL with an example app/test case that shows the unexpected behavior. It's a gradle/grails project that can be run with ./gradlew test
Chris Tosspon opened SPR-14016 and commented
Using Spring 4.1.8.RELEASE, testing a controller method with a response.setIntHeader('Content-length', 5) throws the following Exception
As it seems to be a valid use case to manually set a Content-length header with an integer, the cast of the Object value to String type inside the setSpecialHeader method should be conditional.
I have supplied a referenceURL with an example app/test case that shows the unexpected behavior. It's a gradle/grails project that can be run with
./gradlew test
Affects: 4.1.8
Reference URL: https://github.com/cTwospoons/mock-http-response-int-header-exception
Issue Links:
The text was updated successfully, but these errors were encountered: