在http状态代码前面更改原因短语

时间:2015-11-24 17:02:27

标签: java spring http spring-boot http-status-codes

您好有办法在Spring Boot上更改HTTP状态代码前面的标准原因消息。例如,响应将是:

HTTP/1.1 415 Invalid version of request supplied (content-type)
Content-Type: application/json

短语"提供的请求的无效版本(内容类型)"将替换标准"不支持的媒体类型"。

我已经尝试了

@ResponseStatus(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE, reason = "Invalid version of request supplied (content-type)")

但它不起作用......

此致

0 个答案:

没有答案