mirror of https://github.com/golang/go.git
net/http: sniffTest for 5953 set in http2 mode
Change-Id: I345b6ea7024a1c85c805b2d2e22f9f79aeca5816 Reviewed-on: https://go-review.googlesource.com/17462 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
5d7dc23ec5
commit
b220d41666
|
|
@ -11,7 +11,6 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
. "net/http"
|
||||
"net/http/httptest"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -88,15 +87,18 @@ func testServerContentType(t *testing.T, h2 bool) {
|
|||
|
||||
// Issue 5953: shouldn't sniff if the handler set a Content-Type header,
|
||||
// even if it's the empty string.
|
||||
func TestServerIssue5953(t *testing.T) {
|
||||
func TestServerIssue5953_h1(t *testing.T) { testServerIssue5953(t, false) }
|
||||
func TestServerIssue5953_h2(t *testing.T) { testServerIssue5953(t, true) }
|
||||
|
||||
func testServerIssue5953(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) {
|
||||
w.Header()["Content-Type"] = []string{""}
|
||||
fmt.Fprintf(w, "<html><head></head><body>hi</body></html>")
|
||||
}))
|
||||
defer ts.Close()
|
||||
defer cst.close()
|
||||
|
||||
resp, err := Get(ts.URL)
|
||||
resp, err := cst.c.Get(cst.ts.URL)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue