Add a test for a download without content-size
This commit is contained in:
parent
2177aa574c
commit
d64241bed9
@ -304,3 +304,11 @@ Feature: Downloading things from a website.
|
|||||||
And I run :prompt-accept (tmpdir)/subdir
|
And I run :prompt-accept (tmpdir)/subdir
|
||||||
And I open data/downloads/download2.bin
|
And I open data/downloads/download2.bin
|
||||||
Then the download prompt should be shown with "{downloaddir}/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
|
||||||
|
@ -84,6 +84,22 @@ def redirect_later_continue():
|
|||||||
return flask.Response(b'Continued redirect.')
|
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
|
@app.after_request
|
||||||
def log_request(response):
|
def log_request(response):
|
||||||
"""Log a webserver request."""
|
"""Log a webserver request."""
|
||||||
|
Loading…
Reference in New Issue
Block a user