]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: testStreamingGet now in http2 mode
authorEmmanuel Odeke <emm.odeke@gmail.com>
Tue, 8 Dec 2015 09:01:03 +0000 (02:01 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 8 Dec 2015 22:23:06 +0000 (22:23 +0000)
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>
src/net/http/client_test.go

index e59ab2cd0e06d2bdb3697d639cd7b98c760974eb..09c71b7602ad53a90d5529b70435e90c034d9d12 100644 (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)
        }