forked from orbit-oss/flask
Allow partial content on bytesio
This commit is contained in:
parent
4f3dbb3f3b
commit
b570bf699c
2 changed files with 27 additions and 1 deletions
|
|
@ -10,6 +10,7 @@
|
|||
"""
|
||||
|
||||
import datetime
|
||||
import io
|
||||
import os
|
||||
import uuid
|
||||
|
||||
|
|
@ -608,6 +609,23 @@ class TestSendfile(object):
|
|||
assert rv.status_code == 200
|
||||
rv.close()
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not callable(getattr(Range, 'to_content_range_header', None)),
|
||||
reason="not implemented within werkzeug"
|
||||
)
|
||||
def test_send_file_range_request_bytesio(self, app, client):
|
||||
@app.route('/')
|
||||
def index():
|
||||
file = io.BytesIO(b'somethingsomething')
|
||||
return flask.send_file(
|
||||
file, attachment_filename='filename', conditional=True
|
||||
)
|
||||
|
||||
rv = client.get('/', headers={'Range': 'bytes=4-15'})
|
||||
assert rv.status_code == 206
|
||||
assert rv.data == b'somethingsomething'[4:16]
|
||||
rv.close()
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not callable(getattr(Range, 'to_content_range_header', None)),
|
||||
reason="not implemented within werkzeug"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue