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:
Arjen Poutsma
2009-07-13 09:44:07 +00:00
parent 3a60480e1b
commit df46fe603f
2 changed files with 84 additions and 11 deletions
@@ -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() {