Improve default content type selection
Previously ContentNegotiationManager continued with the next ContentNegotiationStrategy only if the current one returned an empty list. Now it also does that if the current ContentNegotiationStrategy returns "*/*". Since the absence of an Accept header and "*/*" have the same meaning, this allows a default content type to be used in either case. Issue: SPR-10513
This commit is contained in:
@@ -122,6 +122,12 @@ public class ContentNegotiationManagerFactoryBeanTests {
|
||||
ContentNegotiationManager manager = this.factoryBean.getObject();
|
||||
|
||||
assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
|
||||
|
||||
// SPR-10513
|
||||
|
||||
this.servletRequest.addHeader("Accept", MediaType.ALL_VALUE);
|
||||
|
||||
assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user