aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Odeke <emm.odeke@gmail.com>2015-12-08 02:48:10 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2015-12-09 00:24:26 +0000
commitcdc65778a2c36a4dcfcdb412dfcd4008f966af35 (patch)
treed8998ee0f4ce7c452adc0cdc6f237c1a124937c0
parent3d3d6eb79d94d48a6ab7a300e4e7267257733289 (diff)
downloadgo-cdc65778a2c36a4dcfcdb412dfcd4008f966af35.tar.xz
net/http: testClientRedirectEatsBody test now in http2 mode
Change-Id: I181346a8d2a8a96fd790cde087c8fd73af911298 Reviewed-on: https://go-review.googlesource.com/17529 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--src/net/http/client_test.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go
index 09c71b7602..d463c15d53 100644
--- a/src/net/http/client_test.go
+++ b/src/net/http/client_test.go
@@ -1026,18 +1026,26 @@ func TestClientTimeout_Headers(t *testing.T) {
}
}
-func TestClientRedirectEatsBody(t *testing.T) {
+func TestClientRedirectEatsBody_h1(t *testing.T) {
+ testClientRedirectEatsBody(t, false)
+}
+
+func TestClientRedirectEatsBody_h2(t *testing.T) {
+ testClientRedirectEatsBody(t, true)
+}
+
+func testClientRedirectEatsBody(t *testing.T, h2 bool) {
defer afterTest(t)
saw := make(chan string, 2)
- ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
+ cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
saw <- r.RemoteAddr
if r.URL.Path == "/" {
Redirect(w, r, "/foo", StatusFound) // which includes a body
}
}))
- defer ts.Close()
+ defer cst.close()
- res, err := Get(ts.URL)
+ res, err := cst.c.Get(cst.ts.URL)
if err != nil {
t.Fatal(err)
}