You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Spring Boot MVC application where exceptions are handled within a general @ControllerAdvice. Some of them do not include a response body, like for instance:
The problem manifests itself as soon as I add a GET endpoint (in any RestController) that can serve different media types depending on the Accept header of the request. In my case:
The bug, btw, only occurs for exception handlers returning void. If the exception handler returns a response (for example a custom ApiError class), everything works fine.
The text was updated successfully, but these errors were encountered:
Describe the bug
I have a Spring Boot MVC application where exceptions are handled within a general
@ControllerAdvice
. Some of them do not include a response body, like for instance:The exception handler is picked up, but a wrong api response is generated for the 404s:
To Reproduce
The problem manifests itself as soon as I add a GET endpoint (in any RestController) that can serve different media types depending on the Accept header of the request. In my case:
As soon as I put a
@Hidden
on thereadAsStream
method, everything works as expected and the api doc does not include a response for the404
.Expected behavior
I would expect the api doc for the exception handler to never return any content, because its return method reads
void
:The bug, btw, only occurs for exception handlers returning
void
. If the exception handler returns a response (for example a customApiError
class), everything works fine.The text was updated successfully, but these errors were encountered: