-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for custom status code and message in HTTP response #27326
Comments
I'm not sure this is something we can support. If you can show a consistent way to achieve that with plain Servlet API we can consider it. Could you give it a try? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
After reviewing possible solutions, I'm closing this issue. The Servlet API doesn't allow setting the message on the status line - as said previously, the If you'd like to to provide custom error messages, you can add them in the response body (as serialized JSON, for example). Spring Boot is returning such errors to HTTP clients. We're also consider existing specs for error messages in #27052. Thanks! |
We are using spring boot backend service and require to publish custom status code and status message in response. As per current spec spring supports sending custom status code in ResponseEntity's builder ResponseEntity.status(int statusCode) but doesn't have a mechanism to send custom status message along with it.
Sending the code and status message in the response body isn't an option for our use case.
The text was updated successfully, but these errors were encountered: