Back-End/Spring
Spring - HttpServletResponse error 반환시 message가 비어서 올 때
HappyWeasel
2021. 1. 20. 14:37
@ResponseStatus(value= HttpStatus.UNAUTHORIZED)
public class UnauthorizedException extends RuntimeException {
public UnauthorizedException(String message) {
super(message);
}
}
message가 비어서 온다.
{
"timestamp": "2020-05-27T13:44:58.032+00:00",
"status": 401,
"error": "Unauthorized",
"message": "",
"path": "/auth/register"
}
이런 경우에는 yml에 아래와 같이 설정해준다.
server:
error:
include-message: always
include-binding-errors: always