Support "application/problem+json" as the response Content-Type #28189
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Once #28187 provides
ProblemDetail
along with theErrorResponse
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 toapplication/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..The text was updated successfully, but these errors were encountered: