Skip to content

Commit 9b24e5d

Browse files
committed
test: check that we close the connection when streaming
1 parent cd44790 commit 9b24e5d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

http/http_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func TestHTTP(t *testing.T) {
2525
err error
2626
sendErr error
2727
wait bool
28+
close bool
2829
}
2930

3031
tcs := []testcase{
@@ -73,7 +74,8 @@ func TestHTTP(t *testing.T) {
7374
Reader: bytes.NewBufferString("This is the body of the request!"),
7475
Closer: nopCloser{},
7576
}, nil)}),
76-
vs: []interface{}{"i received:", "This is the body of the request!"},
77+
vs: []interface{}{"i received:", "This is the body of the request!"},
78+
close: true,
7779
},
7880
}
7981

@@ -201,6 +203,10 @@ func TestHTTP(t *testing.T) {
201203
}
202204
}
203205

206+
if tc.close && !res.(*Response).res.Close {
207+
t.Error("expected the connection to be closed by the server but it wasn't")
208+
}
209+
204210
wait, ok := getWaitChan(env)
205211
if !ok {
206212
t.Fatal("could not get wait chan")

0 commit comments

Comments
 (0)