diff options
author | Thomas Weißschuh <thomas@t-8ch.de> | 2015-04-26 10:03:50 +0000 |
---|---|---|
committer | Thomas Weißschuh <thomas@t-8ch.de> | 2015-04-27 05:17:03 +0000 |
commit | c92fe455117c2de5224d150bf89d3fbca0c17f9a (patch) | |
tree | c01405891b56e5b36bed226cc483130831738483 /test | |
parent | 548b79a1d1e81bfd297d2ebf1c0129859c656406 (diff) | |
download | urllib3-c92fe455117c2de5224d150bf89d3fbca0c17f9a.tar.gz |
test keep-alive chunked requests
see #598
Diffstat (limited to 'test')
-rw-r--r-- | test/with_dummyserver/test_connectionpool.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py index e76fcb7f..ecf209be 100644 --- a/test/with_dummyserver/test_connectionpool.py +++ b/test/with_dummyserver/test_connectionpool.py @@ -618,6 +618,25 @@ class TestConnectionPool(HTTPDummyServerTestCase): self.assertRaises(ProtocolError, pool.request, 'GET', '/source_address') + def test_stream_keepalive(self): + x = 2 + + for _ in range(x): + response = self.pool.request( + 'GET', + '/chunked', + headers={ + 'Connection': 'keep-alive', + }, + preload_content=False, + retries=0, + ) + for chunk in response.stream(): + self.assertEqual(chunk, b'123') + + self.assertEqual(self.pool.num_connections, 1) + self.assertEqual(self.pool.num_requests, x) + class TestRetry(HTTPDummyServerTestCase): def setUp(self): |