Skip to content

Commit 138e7a0

Browse files
committed
Use ServletResponse#getContentType in ServletServerHttpResponse
This commit updates ServletServerHttpResponse.ServletResponseHttpHeaders in order to use ServletResponse#getContentType instead of ServletResponse#getHeader. It allows to have a consistent behavior between Tomcat (which sets only the former) and Undertow/Jetty (which set both). Closes gh-32339
1 parent 4ce2559 commit 138e7a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: spring-web/src/main/java/org/springframework/http/server/ServletServerHttpResponse.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public String getFirst(String headerName) {
162162
if (headerName.equalsIgnoreCase(CONTENT_TYPE)) {
163163
// Content-Type is written as an override so check super first
164164
String value = super.getFirst(headerName);
165-
return (value != null ? value : servletResponse.getHeader(headerName));
165+
return (value != null ? value : servletResponse.getContentType());
166166
}
167167
else {
168168
String value = servletResponse.getHeader(headerName);

0 commit comments

Comments
 (0)