Skip to content

Support "application/problem+json" as the response Content-Type #28189

Closed
@rstoyanchev

Description

@rstoyanchev

Once #28187 provides ProblemDetail along with the ErrorResponse hierarchy of exceptions that encapsulate HTTP status, headers, and body, to support RFC 7807, it is also necessary to improve content negotiation and formatting specifically for error responses.

In Spring MVC it is possible to configure content type resolution and message conversion and likewise in WebFlux to configure content type resolution and message codecs, but those apply to both @RequestMapping and @ExceptionHandler methods.

Error handling however has a different perspective. The range of supported media types might be more limited and different, e.g. only application/problem+json. The resolution of the request content type might also be done differently, .e.g. defaulting to application/problem+json if not explicitly requested, or perhaps even enforcing it.

Such a mechanism is also a convenient place for other configuration related to how ProblemDetail should be rendered..

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions