]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: fix data race in test
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 2 Nov 2012 20:26:36 +0000 (00:26 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 2 Nov 2012 20:26:36 +0000 (00:26 +0400)
The issue is that server still sends body,
when client closes the fd.
Fixes #4329.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6822072

src/pkg/net/http/fs_test.go

index 7c7015c297dfa6edfdaaedf72aa5adc30e8fa14d..ebe34dbcbf38e7e19b124738731df2c87aa2c514 100644 (file)
@@ -648,6 +648,8 @@ func TestServeContent(t *testing.T) {
                if err != nil {
                        t.Fatal(err)
                }
+               io.Copy(ioutil.Discard, res.Body)
+               res.Body.Close()
                if res.StatusCode != tt.wantStatus {
                        t.Errorf("test %q: status = %d; want %d", testName, res.StatusCode, tt.wantStatus)
                }