mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 14:09:25 +00:00
SPR-5870 - Add support for content negotiation based on a request parameter value
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1530 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+11
@@ -66,6 +66,17 @@ public class ContentNegotiatingViewResolverTests {
|
||||
assertEquals("Invalid content type", Collections.singletonList(new MediaType("application", "xhtml+xml")),
|
||||
result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMediaTypeParameter() {
|
||||
viewResolver.setFavorParameter(true);
|
||||
viewResolver.setMediaTypes(Collections.singletonMap("html", "application/xhtml+xml"));
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/test");
|
||||
request.addParameter("format", "html");
|
||||
List<MediaType> result = viewResolver.getMediaTypes(request);
|
||||
assertEquals("Invalid content type", Collections.singletonList(new MediaType("application", "xhtml+xml")),
|
||||
result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMediaTypeAcceptHeader() {
|
||||
|
||||
Reference in New Issue
Block a user