Commit 92686dda authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

net/http: fix data race in test

Fixes #2712.

R=golang-dev, dsymonds
CC=golang-dev, mpimenov
https://golang.org/cl/5543062
parent ba7dc5de
......@@ -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)
}
......
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