HandlerInterceptor.afterCompletion() in spring MVC changes response code
You need to make sure that you call setStatus
method on your response
object on exception.
If you assert this, than upgrading to spring boot version 1.1.11 can fix your issue. It concerns this fix. Prior to the fix, the ErrorPageFilter
was masking the response status of wrapped response in the cases where sendError
method is not explicitely called on the ErrorWrapperResponse
.
The code after the fixed changed from simple return this.status
to
if (this.errorToSend) { return this.status; } else { // If there was no error we need to trust the wrapped response return super.getStatus(); }
that is why I believe that the upgrade will fix your issue.
Finally, if you issue persist, debugging through ErrorPageFilter
should indicate the origin of the problem