More types

master
bel 2020-04-13 20:47:42 +00:00
parent 05ef683334
commit 66a35fcf10
2 changed files with 22 additions and 2 deletions

Binary file not shown.

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)) {
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")
}
}