Commit 10d1d5b6 authored by Emmanuel Odeke's avatar Emmanuel Odeke Committed by Brad Fitzpatrick

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