Use .setStatus in ResponseStatusExceptionResolver
Before this change ResponseStatusExceptionResolver always used .sendError despite the javadoc on @ResponseStatus#code. This was perhaps justifiable from a HandlerExceptionResolver. Nevertheless .setStatus should be more REST API friendly while still marking the response as an error. Issue: SPR-11193
This commit is contained in:
parent
8d7812b1b6
commit
0ef8af4798
|
@ -101,7 +101,7 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes
|
|||
reason = this.messageSource.getMessage(reason, null, reason, LocaleContextHolder.getLocale());
|
||||
}
|
||||
if (!StringUtils.hasLength(reason)) {
|
||||
response.sendError(statusCode);
|
||||
response.setStatus(statusCode);
|
||||
}
|
||||
else {
|
||||
response.sendError(statusCode, reason);
|
||||
|
|
Loading…
Reference in New Issue