Closed birnbuazn closed 4 years ago
@birnbuazn,
Not reproducible, with the provided description. You mention spring-mvc, but your example contains webflux. The expected response is correct.
Please make sure you have read the contribution guide: section Using GitHub Issues
We have added an enhancement to handle similar cases, which may fix your issue as well:
If you believe the issue is still there, please provide a complete minimal reproducible sample.
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.