Commit c6d660a3 authored by Emmanuel Odeke's avatar Emmanuel Odeke Committed by Brad Fitzpatrick

net/http: make TestRedirect also test in http2 mode

Change-Id: Idfbe91abc11b2b3b735cd8d11fb1938f9e5c0473
Reviewed-on: https://go-review.googlesource.com/17437Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c2290fee
......@@ -13,7 +13,6 @@ import (
"io/ioutil"
"mime/multipart"
. "net/http"
"net/http/httptest"
"net/url"
"os"
"reflect"
......@@ -177,9 +176,12 @@ func TestParseMultipartForm(t *testing.T) {
}
}
func TestRedirect(t *testing.T) {
func TestRedirect_h1(t *testing.T) { testRedirect(t, false) }
func TestRedirect_h2(t *testing.T) { testRedirect(t, true) }
func testRedirect(t *testing.T, h2 bool) {
defer afterTest(t)
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
switch r.URL.Path {
case "/":
w.Header().Set("Location", "/foo/")
......@@ -190,10 +192,10 @@ func TestRedirect(t *testing.T) {
w.WriteHeader(StatusBadRequest)
}
}))
defer ts.Close()
defer cst.close()
var end = regexp.MustCompile("/foo/$")
r, err := Get(ts.URL)
r, err := cst.c.Get(cst.ts.URL)
if err != nil {
t.Fatal(err)
}
......
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