1
0
mirror of https://github.com/golang/go synced 2024-11-20 10:44:41 -07:00

net/http: use r.Body.Close to close connection during TestServeFileFromCWD

Fixes #3917.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6553061
This commit is contained in:
Alex Brainman 2012-09-24 12:48:19 +10:00
parent 659d1df1bc
commit 5d50dbc55a

View File

@ -340,11 +340,6 @@ func TestServeFileMimeType(t *testing.T) {
} }
func TestServeFileFromCWD(t *testing.T) { func TestServeFileFromCWD(t *testing.T) {
if runtime.GOOS == "windows" {
// TODO(brainman): find out why this test is broken
t.Logf("Temporarily skipping test on Windows; see http://golang.org/issue/3917")
return
}
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
ServeFile(w, r, "fs_test.go") ServeFile(w, r, "fs_test.go")
})) }))
@ -353,6 +348,7 @@ func TestServeFileFromCWD(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
r.Body.Close()
if r.StatusCode != 200 { if r.StatusCode != 200 {
t.Fatalf("expected 200 OK, got %s", r.Status) t.Fatalf("expected 200 OK, got %s", r.Status)
} }