mirror of
https://github.com/golang/go
synced 2024-11-21 17:34:40 -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:
parent
75ca6d189c
commit
81cfb4ec2b
@ -143,7 +143,7 @@ func serveFile(w ResponseWriter, r *Request, name string, redirect bool) {
|
||||
n, _ := io.ReadFull(f, buf[:])
|
||||
b := buf[:n]
|
||||
if isText(b) {
|
||||
ctype = "text-plain; charset=utf-8"
|
||||
ctype = "text/plain; charset=utf-8"
|
||||
} else {
|
||||
// generic binary
|
||||
ctype = "application/octet-stream"
|
||||
|
@ -104,7 +104,7 @@ func TestServeFileContentType(t *testing.T) {
|
||||
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
|
||||
get(ctype)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user