This commit improves SPR-13090 and avoids adding duplicate ETag and
Last-Modified headers in HTTP responses.
Previously, those were added twice to the response since:
* we're adding all ResponseEntity headers to the response
* the `checkNotModified` methods automatically add those headers
Issue: SPR-13090
@ -168,12 +168,15 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
@@ -168,12 +168,15 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
// Ensure headers are flushed, no body should be written.
outputMessage.flush();
@ -181,6 +184,11 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
@@ -181,6 +184,11 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
return;
}
}
else{
if(!entityHeaders.isEmpty()){
outputMessage.getHeaders().putAll(entityHeaders);
}
}
// Try even with null body. ResponseBodyAdvice could get involved.