示例#1
0
文件: HTTPTest.java 项目: arnou/restx
 @Test
 public void should_find_mime_type() throws Exception {
   assertThat(HTTP.getContentTypeFromExtension("test.js"))
       .isEqualTo(Optional.of("application/x-javascript"));
   assertThat(HTTP.getContentTypeFromExtension("html")).isEqualTo(Optional.of("text/html"));
   assertThat(HTTP.getContentTypeFromExtension("css")).isEqualTo(Optional.of("text/css"));
 }
示例#2
0
文件: HTTPTest.java 项目: arnou/restx
 @Test
 public void should_extract_charset() throws Exception {
   assertThat(HTTP.charsetFromContentType("text/html; charset=UTF-8"))
       .isEqualTo(Optional.of("UTF-8"));
   assertThat(HTTP.charsetFromContentType("application/json; charset=ISO-8859-1"))
       .isEqualTo(Optional.of("ISO-8859-1"));
   assertThat(HTTP.charsetFromContentType("application/json"))
       .isEqualTo(Optional.<String>absent());
 }