More types
parent
05ef683334
commit
66a35fcf10
BIN
exec-simpleserve
BIN
exec-simpleserve
Binary file not shown.
24
main.go
24
main.go
|
|
@ -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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue