Browse Source
Prior to this commit, calls to setHeader() and addHeader() in MockHttpServletResponse would result in an IllegalArgumentException or NullPointerException if the supplied header value was null. Although the Javadoc for setHeader(String, String) and addHeader(String, String) in javax.servlet.http.HttpServletResponse does not specify how a null header value should be handled, both Tomcat and Jetty simply ignore a null value. Furthermore, org.springframework.http.HttpHeaders.add(String, String) declares the headerValue parameter as @Nullable. This commit therefore updates MockHttpServletResponse to silently ignore null header values passed to setHeader() and addHeader(). Closes gh-26488pull/26504/head
3 changed files with 53 additions and 13 deletions
Loading…
Reference in new issue