Commit 81cfb4ec authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

http: fix FileServer's default text content type

Fixes #1729

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4443057
parent 75ca6d18
...@@ -143,7 +143,7 @@ func serveFile(w ResponseWriter, r *Request, name string, redirect bool) { ...@@ -143,7 +143,7 @@ func serveFile(w ResponseWriter, r *Request, name string, redirect bool) {
n, _ := io.ReadFull(f, buf[:]) n, _ := io.ReadFull(f, buf[:])
b := buf[:n] b := buf[:n]
if isText(b) { if isText(b) {
ctype = "text-plain; charset=utf-8" ctype = "text/plain; charset=utf-8"
} else { } else {
// generic binary // generic binary
ctype = "application/octet-stream" ctype = "application/octet-stream"
......
...@@ -104,7 +104,7 @@ func TestServeFileContentType(t *testing.T) { ...@@ -104,7 +104,7 @@ func TestServeFileContentType(t *testing.T) {
t.Errorf("Content-Type mismatch: got %q, want %q", h, want) t.Errorf("Content-Type mismatch: got %q, want %q", h, want)
} }
} }
get("text-plain; charset=utf-8") get("text/plain; charset=utf-8")
override = true override = true
get(ctype) get(ctype)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment