I have my controller configured with this and both have differrent implementations as 1 returns json and other returns zip
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET, headers = "Accept=application/json", produces = "application/json")
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET, headers = "Accept=application/zip", produces = "application/zip")
When i make a request with header Accept = 'application/xml'
(or any thing other than application/json and application/zip') It used to give 406 StatusCode in Spring 4.1.5 but when i have updated Spring Version to 5.0.7 and Spring boot to 2.0.5 it is returning 500 StatusCode
Can I know why the behavior is changed and what is the solution as i need 406.?
Comment From: rstoyanchev
Do you have the actual exception?
Also those mappings can be updated to use the HTTP method shortcut annotations and likewise there is no need for that headers "Accept" mapping, which is turned into a produces condition anyway. In other words just:
@GetMapping(path = "/get/{id}", produces = "application/json")
@GetMapping(path = "/get/{id}", produces = "application/zip")
Comment From: spring-projects-issues
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.