-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Retain order of produces
media types in @ExceptionHandler
#35587
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
base: 6.2.x
Are you sure you want to change the base?
Retain order of produces
media types in @ExceptionHandler
#35587
Conversation
produces
media types in @ExceptionHandler
Hi @IMurzich, Congratulations on submitting your first PR for the Spring Framework! 👍 However, before we process this PR, we need to take care of the following.
Regarding point # 1, I realize you added some text to this issue's description, but it is not fully clear to me what you mean. So, perhaps you can just expound on that. Thanks |
Hi @sbrannen, I've added test. Please check it. Thanks. |
Purpose of change: I have a controller and exception handler in it. My REST service can return JSON or XML replies. Therefore I want to return exceptions in JSON or XML too. Exception handler is annotated with: @ExceptionHandler(exception = Exception.class, produces = {"application/json", "application/xml"}) And I expect to get JSON response with error ( |
@IMurzich, can you please sign off your commits so that the Developer Certificate of Origin (DCO) check passes? Thanks |
Fix error when corrupt order of
produces
media types for@ExceptionHandler
.For example, the following returns xml by default.