Skip to content

Commit 91c11db

Browse files
committed
feat(content): set Content-Type only if missing for HEAD req
1 parent 5a7f568 commit 91c11db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/serverHandler/content.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ func (h *aliasHandler) content(w http.ResponseWriter, r *http.Request, data *res
4040
ctype, err := util.GetContentType(item.Name(), file)
4141
if err == nil {
4242
header.Set("Accept-Ranges", "bytes")
43-
header.Set("Content-Type", ctype)
43+
if len(header.Values("Content-Type")) == 0 {
44+
header.Set("Content-Type", ctype)
45+
}
4446
header.Set("Content-Length", strconv.FormatInt(item.Size(), 10))
4547
header.Set("Date", time.Now().UTC().Format(http.TimeFormat))
4648
header.Set("Last-Modified", item.ModTime().UTC().Format(http.TimeFormat))

0 commit comments

Comments
 (0)