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

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 5d7dc23e
......@@ -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)
}
......
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