Browse Source
Prior to this commit, the `ExceptionHandlerExceptionResolver` would resolve exceptions and handle them by writing to the HTTP response body, even if the request was already partially handled and content was written to the response body. This could result in HTTP responses with some content for the intended application response, then other content for the handled exception. This would happen especially when the error would be raised while writing to the response (for example when serializing content). This commit attempts to reset the HTTP response before handling the exception. This effectively resets the response buffer for the body as well as response headers. If the response is already committed, the Servlet container raises an exception and the exception handling is skipped altogether in order to avoid garbled responses. Closes gh-31104pull/31135/head
2 changed files with 23 additions and 0 deletions
Loading…
Reference in new issue