From c6109e23afa8821885ae89220730bccc7b36adfe Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 13 Apr 2020 20:47:42 +0000 Subject: [PATCH] More types --- main.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 5cb15d5..81caf4b 100755 --- a/main.go +++ b/main.go @@ -207,8 +207,6 @@ func setContentTypeIfMedia(w http.ResponseWriter, r *http.Request) { switch strings.ToLower(path.Ext(r.URL.Path)) { case ".mp4": w.Header().Set("Content-Type", "video/mp4") - case ".webm": - w.Header().Set("Content-Type", "video/webm") case ".mkv": w.Header().Set("Content-Type", "video/x-matroska") case ".mp3": @@ -225,5 +223,27 @@ func setContentTypeIfMedia(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "image/x-icon") case ".svg": w.Header().Set("Content-Type", "image/svg+xml") + case ".css": + w.Header().Set("Content-Type", "text/css") + case ".js": + w.Header().Set("Content-Type", "text/javascript") + case ".json": + w.Header().Set("Content-Type", "application/json") + case ".html", ".htm": + w.Header().Set("Content-Type", "text/html") + case ".pdf": + w.Header().Set("Content-Type", "application/pdf") + case ".webm": + w.Header().Set("Content-Type", "video/webm") + case ".weba": + w.Header().Set("Content-Type", "audio/webm") + case ".webp": + w.Header().Set("Content-Type", "image/webp") + case ".zip": + w.Header().Set("Content-Type", "application/zip") + case ".7z": + w.Header().Set("Content-Type", "application/x-7z-compressed") + case ".tar": + w.Header().Set("Content-Type", "application/x-tar") } }