Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
SetStatus (int sc, java.lang.String sm) of HttpServletResponse is deprecated #709
SetStatus with two arguments is deprecated.
If resutl code is 4xx or 5xx, if you want to set status line, you should change body so that it does not send body, but directly returns result using sendError method.
However, because of the HTTP protocol standard, there is no such limitation in the status line, so I do not know if it is correct to be deprecated...
It is not inconsistent with the existing test code in the following changes
- response.status = ResponseStatus(status, reason) + response.sendError(status, reason)
- res.setStatus(statusLine.code, statusLine.message) + res.setStatus(statusLine.code)
In the future, I think that the place to set the reason-phrase should be limited (only when returning the error immediately without the body part) or not to set it at all, but I think that should not change suddenly So I created a PR that warns on scenes where both reason-phrase and body are set.