SEC-2221: Fix the ignored media types to use includes instead of equals

This commit is contained in:
Rob Winch
2013-08-15 13:58:50 -05:00
parent 54c2166567
commit 75fb971d23
2 changed files with 19 additions and 1 deletions

View File

@@ -183,4 +183,13 @@ public class MediaTypeRequestMatcherTests {
assertThat(matcher.matches(request)).isTrue();
}
@Test
public void mediaAllQ08AndTextPlainIgnoreMediaTypeAll() throws HttpMediaTypeNotAcceptableException {
when(negotiationStrategy.resolveMediaTypes(any(NativeWebRequest.class))).thenReturn(Arrays.asList(MediaType.TEXT_PLAIN,MediaType.parseMediaType("*/*;q=0.8")));
matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.TEXT_HTML);
matcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
assertThat(matcher.matches(request)).isFalse();
}
}