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

net/http: make testCaseSensitiveMethod also test http2

Change-Id: I6427b0914fc4ccd9b841eae3aefe3b7a355fc436
Reviewed-on: https://go-review.googlesource.com/17596
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 9a89ac35
...@@ -2181,20 +2181,24 @@ func TestServerGracefulClose(t *testing.T) { ...@@ -2181,20 +2181,24 @@ func TestServerGracefulClose(t *testing.T) {
<-writeErr <-writeErr
} }
func TestCaseSensitiveMethod(t *testing.T) { func TestCaseSensitiveMethod_h1(t *testing.T) { testCaseSensitiveMethod(t, false) }
func TestCaseSensitiveMethod_h2(t *testing.T) { testCaseSensitiveMethod(t, true) }
func testCaseSensitiveMethod(t *testing.T, h2 bool) {
defer afterTest(t) defer afterTest(t)
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
if r.Method != "get" { if r.Method != "get" {
t.Errorf(`Got method %q; want "get"`, r.Method) t.Errorf(`Got method %q; want "get"`, r.Method)
} }
})) }))
defer ts.Close() defer cst.close()
req, _ := NewRequest("get", ts.URL, nil) req, _ := NewRequest("get", cst.ts.URL, nil)
res, err := DefaultClient.Do(req) res, err := cst.c.Do(req)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
return return
} }
res.Body.Close() res.Body.Close()
} }
......
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