I am using below ControllerAdvice to return error response. But vendor who are writing client code are complaining that they don't get reasonPhrase/StatusDescription with this. They are expecting 'Bad Request'. They using vb.net. Told them it will be easy to use enum System.Net.HttpStatusCode to get reasonPhrase/StatusDescription . But that will cost extra. How do I send reasonPhrase/StatusDescription with this response?
I think they getting something like and expecting StatusDescription should contain "Bad Request". We are deploying server code as jar and not using Tomcat.
StatusCode : 400
StatusDescription :
Content : Constrained value error.
/**
* @param constrainedValueNotFoundException - exception object
* @return - ResponseEntity with http status code and error message
*/
@ExceptionHandler(value = ConstrainedValueNotFoundException.class)
public ResponseEntity<String> constrainedValueNotFoundException(
ConstrainedValueNotFoundException constrainedValueNotFoundException) {
logError(constrainedValueNotFoundException);
return new ResponseEntity<>(
constrainedValueNotFoundException.getLocalizedMessage(), BAD_REQUEST);
}