Skip to content

Commit

Permalink
test: check that we close the connection when streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Dec 13, 2018
1 parent cd44790 commit 9b24e5d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestHTTP(t *testing.T) {
err error
sendErr error
wait bool
close bool
}

tcs := []testcase{
Expand Down Expand Up @@ -73,7 +74,8 @@ func TestHTTP(t *testing.T) {
Reader: bytes.NewBufferString("This is the body of the request!"),
Closer: nopCloser{},
}, nil)}),
vs: []interface{}{"i received:", "This is the body of the request!"},
vs: []interface{}{"i received:", "This is the body of the request!"},
close: true,
},
}

Expand Down Expand Up @@ -201,6 +203,10 @@ func TestHTTP(t *testing.T) {
}
}

if tc.close && !res.(*Response).res.Close {
t.Error("expected the connection to be closed by the server but it wasn't")
}

wait, ok := getWaitChan(env)
if !ok {
t.Fatal("could not get wait chan")
Expand Down

0 comments on commit 9b24e5d

Please sign in to comment.