More types

master
bel 2020-04-13 20:47:42 +00:00
parent 6ae09962ad
commit c6109e23af
1 changed files with 22 additions and 2 deletions

24
main.go
View File

@ -207,8 +207,6 @@ func setContentTypeIfMedia(w http.ResponseWriter, r *http.Request) {
switch strings.ToLower(path.Ext(r.URL.Path)) { switch strings.ToLower(path.Ext(r.URL.Path)) {
case ".mp4": case ".mp4":
w.Header().Set("Content-Type", "video/mp4") w.Header().Set("Content-Type", "video/mp4")
case ".webm":
w.Header().Set("Content-Type", "video/webm")
case ".mkv": case ".mkv":
w.Header().Set("Content-Type", "video/x-matroska") w.Header().Set("Content-Type", "video/x-matroska")
case ".mp3": case ".mp3":
@ -225,5 +223,27 @@ func setContentTypeIfMedia(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/x-icon") w.Header().Set("Content-Type", "image/x-icon")
case ".svg": case ".svg":
w.Header().Set("Content-Type", "image/svg+xml") 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")
} }
} }