コード例 #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());
 }