use the Get/Set function of Header

This commit is contained in:
thinkerou 2017-10-27 10:57:37 +08:00
parent 1e88466d23
commit 52235568e0

View File

@ -28,7 +28,7 @@ var (
func writeContentType(w http.ResponseWriter, value []string) {
header := w.Header()
if val := header["Content-Type"]; len(val) == 0 {
header["Content-Type"] = value
if header.Get("Content-Type") == "" {
header.Set("Content-Type", value)
}
}