From f78769e0f76ae4453631ab18fbf82dec4031ebb4 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Thu, 7 May 2015 10:34:36 +0200 Subject: [PATCH] Support mp4 and mp3 --- src/main/java/net/codestory/http/types/ContentTypes.java | 4 ++++ src/test/java/net/codestory/http/types/ContentTypesTest.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/net/codestory/http/types/ContentTypes.java b/src/main/java/net/codestory/http/types/ContentTypes.java index c3838d57..7cad8385 100644 --- a/src/main/java/net/codestory/http/types/ContentTypes.java +++ b/src/main/java/net/codestory/http/types/ContentTypes.java @@ -77,6 +77,10 @@ public static String get(String filename) { return "application/x-font-woff"; case ".ico": return "image/x-icon"; + case ".mp4": + return "video/mp4"; + case ".mp3": + return "audio/mpeg"; default: return "text/plain;charset=UTF-8"; } diff --git a/src/test/java/net/codestory/http/types/ContentTypesTest.java b/src/test/java/net/codestory/http/types/ContentTypesTest.java index 6b57a9e0..27b93e95 100644 --- a/src/test/java/net/codestory/http/types/ContentTypesTest.java +++ b/src/test/java/net/codestory/http/types/ContentTypesTest.java @@ -48,6 +48,8 @@ public void content_type_from_extension() { assertThat(get("script.coffee")).isEqualTo("application/javascript;charset=UTF-8"); assertThat(get("script.litcoffee")).isEqualTo("application/javascript;charset=UTF-8"); assertThat(get("favicon.ico")).isEqualTo("image/x-icon"); + assertThat(get("video.mp4")).isEqualTo("video/mp4"); + assertThat(get("video.mp3")).isEqualTo("audio/mpeg"); assertThat(get("unknown")).isEqualTo("text/plain;charset=UTF-8"); } }