Skip to content

@RequestMapping content negotiation should not impact error responses formats #22452

Closed
@bclozel

Description

@bclozel

This issue a follow-up issue to #20865.

In #20865, the negotiated content-type during the request mapping phase would impact the content type chosen for the @ExceptionHandler error response instead of restarting the content negotiation phase. This has been fixed by removing the negotiated content type before handling errors.

In this case, the negotiated content type information is kept in a different place.

When setting up the reactive pipeline with the chosen EncoderHttpMessageWriter, the response content type is set before the subscription happens. Later when the returned value from the error handling phase is handled in HandlerResultHandlerSupport.selectMediaType, the response content-type is already set and chosen directly.

The only difference with #20865 is that the content type is set before the subscription happens and is not cleared before handling the error response.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions