1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:24:39 -07:00

http: fix FileServer's default text content type

Fixes #1729

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4443057
This commit is contained in:
Brad Fitzpatrick 2011-04-22 09:09:37 -07:00
parent 75ca6d189c
commit 81cfb4ec2b
2 changed files with 2 additions and 2 deletions

View File

@ -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"

View File

@ -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)
} }