-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Lifu Zhou opened SPR-14315 and commented
If a controller method's specification were:
public ResponseEntity<StreamingResponseBody> foo(){
// code...
}
and returns:
return new ResponseEntity<StreamingResponseBody>(someHeaders, HttpStatus.OK);
Then, the headers would be lost because they weren't flushed after not null check:
// StreamingResponseBodyReturnValueHandler#handleReturnValue
if (ResponseEntity.class.isAssignableFrom(returnValue.getClass())) {
ResponseEntity<?> responseEntity = (ResponseEntity<?>) returnValue;
outputMessage.setStatusCode(responseEntity.getStatusCode());
outputMessage.getHeaders().putAll(responseEntity.getHeaders());
returnValue = responseEntity.getBody();
if (returnValue == null) {
mavContainer.setRequestHandled(true);
return; // <--- here, return directly without flushing headers.
}
}
But I'm not sure it was intentional or just a oversight ;)
Affects: 4.3 RC2
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug