diff options
| author | Konstantin Alekseev <mail@kalekseev.com> | 2018-12-06 18:08:01 +0300 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2018-12-19 11:27:08 +0100 |
| commit | b514dc14f4e1c364341f5931b354e83ef15ee12d (patch) | |
| tree | b67ab081db929f87b83dec0a234861f79dc7be30 /tests/servers/tests.py | |
| parent | 1939dd49d142b65fa22eb5f85cee0d20864d3730 (diff) | |
| download | django-b514dc14f4e1c364341f5931b354e83ef15ee12d.tar.gz | |
Fixed #30015 -- Ensured request body is properly consumed for keep-alive connections.
Diffstat (limited to 'tests/servers/tests.py')
| -rw-r--r-- | tests/servers/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/servers/tests.py b/tests/servers/tests.py index e38cb5eb07..5917e30d24 100644 --- a/tests/servers/tests.py +++ b/tests/servers/tests.py @@ -111,6 +111,23 @@ class LiveServerViews(LiveServerBase): finally: conn.close() + def test_keep_alive_connection_clears_previous_request_data(self): + conn = HTTPConnection(LiveServerViews.server_thread.host, LiveServerViews.server_thread.port) + try: + conn.request('POST', '/method_view/', b'{}', headers={"Connection": "keep-alive"}) + response = conn.getresponse() + self.assertFalse(response.will_close) + self.assertEqual(response.status, 200) + self.assertEqual(response.read(), b'POST') + + conn.request('POST', '/method_view/', b'{}', headers={"Connection": "close"}) + response = conn.getresponse() + self.assertFalse(response.will_close) + self.assertEqual(response.status, 200) + self.assertEqual(response.read(), b'POST') + finally: + conn.close() + def test_404(self): with self.assertRaises(HTTPError) as err: self.urlopen('/') |
