net/http: testStreamingGet now in http2 mode

Change-Id: I9a1fe057f5bf008fa16577a7d71064050aea47e9
Reviewed-on: https://go-review.googlesource.com/17525
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:
Emmanuel Odeke 2015-12-08 02:01:03 -07:00 committed by Brad Fitzpatrick
parent 9b8080f37e
commit 10d1d5b673

View File

@ -493,20 +493,23 @@ func (j *RecordingJar) logf(format string, args ...interface{}) {
fmt.Fprintf(&j.log, format, args...)
}
func TestStreamingGet(t *testing.T) {
func TestStreamingGet_h1(t *testing.T) { testStreamingGet(t, false) }
func TestStreamingGet_h2(t *testing.T) { testStreamingGet(t, true) }
func testStreamingGet(t *testing.T, h2 bool) {
defer afterTest(t)
say := make(chan string)
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
w.(Flusher).Flush()
for str := range say {
w.Write([]byte(str))
w.(Flusher).Flush()
}
}))
defer ts.Close()
defer cst.close()
c := &Client{}
res, err := c.Get(ts.URL)
c := cst.c
res, err := c.Get(cst.ts.URL)
if err != nil {
t.Fatal(err)
}