SPR-7135 - org.springframework.http.MediaType#checkParameters fails to process a Content-Type like application/xml;charset="utf-8"

This commit is contained in:
Arjen Poutsma
2010-04-27 08:26:51 +00:00
parent 8ce4037af2
commit c2707150b1
2 changed files with 19 additions and 1 deletions

View File

@@ -180,6 +180,15 @@ public class MediaTypeTests {
assertEquals("Invalid charset", Charset.forName("ISO-8859-1"), mediaType.getCharSet());
}
@Test
public void parseQuotedCharset() {
String s = "application/xml;charset=\"utf-8\"";
MediaType mediaType = MediaType.parseMediaType(s);
assertEquals("Invalid type", "application", mediaType.getType());
assertEquals("Invalid subtype", "xml", mediaType.getSubtype());
assertEquals("Invalid charset", Charset.forName("UTF-8"), mediaType.getCharSet());
}
@Test
public void parseURLConnectionMediaType() throws Exception {
String s = "*; q=.2";