summaryrefslogtreecommitdiff
path: root/src/pkg/net/http/httptest/server_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/http/httptest/server_test.go')
-rw-r--r--src/pkg/net/http/httptest/server_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/pkg/net/http/httptest/server_test.go b/src/pkg/net/http/httptest/server_test.go
index 500a9f0b8..501cc8a99 100644
--- a/src/pkg/net/http/httptest/server_test.go
+++ b/src/pkg/net/http/httptest/server_test.go
@@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"testing"
+ "time"
)
func TestServer(t *testing.T) {
@@ -27,3 +28,25 @@ func TestServer(t *testing.T) {
t.Errorf("got %q, want hello", string(got))
}
}
+
+func TestIssue7264(t *testing.T) {
+ for i := 0; i < 1000; i++ {
+ func() {
+ inHandler := make(chan bool, 1)
+ ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ inHandler <- true
+ }))
+ defer ts.Close()
+ tr := &http.Transport{
+ ResponseHeaderTimeout: time.Nanosecond,
+ }
+ defer tr.CloseIdleConnections()
+ c := &http.Client{Transport: tr}
+ res, err := c.Get(ts.URL)
+ <-inHandler
+ if err == nil {
+ res.Body.Close()
+ }
+ }()
+ }
+}