1
0
mirror of https://github.com/golang/go synced 2024-11-24 23:57:57 -07:00

net/http: fix data race in test

Fixes #2712.

R=golang-dev, dsymonds
CC=golang-dev, mpimenov
https://golang.org/cl/5543062
This commit is contained in:
Dmitriy Vyukov 2012-01-16 14:47:33 +04:00
parent ba7dc5de06
commit 92686dda7c

View File

@ -224,9 +224,9 @@ func TestEmptyDirOpenCWD(t *testing.T) {
func TestServeFileContentType(t *testing.T) {
const ctype = "icecream/chocolate"
override := false
override := make(chan bool, 1)
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
if override {
if <-override {
w.Header().Set("Content-Type", ctype)
}
ServeFile(w, r, "testdata/file")
@ -241,8 +241,9 @@ func TestServeFileContentType(t *testing.T) {
t.Errorf("Content-Type mismatch: got %q, want %q", h, want)
}
}
override <- false
get("text/plain; charset=utf-8")
override = true
override <- true
get(ctype)
}