mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 17:23:25 +01:00
test_download_no_Content_Length
This commit is contained in:
parent
87c59ae561
commit
8e112a6948
@ -979,7 +979,7 @@ Anonymous Sessions
|
||||
------------------
|
||||
|
||||
Instead of a name, you can also directly specify a path to a session file. This
|
||||
allows for re-using session across multiple hosts:
|
||||
allows for sessions to be re-used across multiple hosts:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -1601,9 +1601,23 @@ class DownloadTest(BaseTestCase):
|
||||
self.assertIn('Done', r.stderr)
|
||||
self.assertEqual(body, r)
|
||||
|
||||
def test_download_with_Content_Length(self):
|
||||
download = Download(output_file=open(os.devnull, 'w'))
|
||||
download.start(Response(
|
||||
url=httpbin('/'),
|
||||
headers={'Content-Length': 10}
|
||||
))
|
||||
time.sleep(1.1)
|
||||
download._chunk_downloaded(b'12345')
|
||||
time.sleep(1.1)
|
||||
download._chunk_downloaded(b'12345')
|
||||
download.finish()
|
||||
self.assertFalse(download.interrupted)
|
||||
|
||||
def test_download_no_Content_Length(self):
|
||||
download = Download(output_file=open(os.devnull, 'w'))
|
||||
download.start(Response(url=httpbin('/')))
|
||||
time.sleep(1.1)
|
||||
download._chunk_downloaded(b'12345')
|
||||
download.finish()
|
||||
self.assertFalse(download.interrupted)
|
||||
|
Loading…
Reference in New Issue
Block a user