Add a test for a download without content-size

This commit is contained in:
Florian Bruhin 2016-09-09 16:58:39 +02:00
parent 2177aa574c
commit d64241bed9
2 changed files with 24 additions and 0 deletions

View File

@ -304,3 +304,11 @@ Feature: Downloading things from a website.
And I run :prompt-accept (tmpdir)/subdir
And I open data/downloads/download2.bin
Then the download prompt should be shown with "{downloaddir}/download2.bin"
## Other
Scenario: Download without a content-size
When I set storage -> prompt-download-directory to false
When I run :download http://localhost:(port)/custom/content-size
And I wait until the download is finished
Then the downloaded file content-size should exist

View File

@ -84,6 +84,22 @@ def redirect_later_continue():
return flask.Response(b'Continued redirect.')
@app.route('/custom/content-size')
def content_size():
"""Send two bytes of data without a content-size."""
def generate_bytes():
yield b'*'
time.sleep(0.2)
yield b'*'
response = flask.Response(generate_bytes(), headers={
"Content-Type": "application/octet-stream",
})
response.status_code = 200
return response
@app.after_request
def log_request(response):
"""Log a webserver request."""