need to test against raw header
parsing prefers the last value parsed for the option
This commit is contained in:
parent
c1973016ea
commit
f790ab7177
1 changed files with 8 additions and 13 deletions
|
|
@ -541,7 +541,7 @@ class TestSendfile(object):
|
||||||
parse_options_header(rv.headers['Content-Disposition'])
|
parse_options_header(rv.headers['Content-Disposition'])
|
||||||
assert value == 'attachment'
|
assert value == 'attachment'
|
||||||
assert options['filename'] == 'index.html'
|
assert options['filename'] == 'index.html'
|
||||||
assert 'filename*' not in options
|
assert 'filename*' not in rv.headers['Content-Disposition']
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
||||||
with app.test_request_context():
|
with app.test_request_context():
|
||||||
|
|
@ -565,20 +565,15 @@ class TestSendfile(object):
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
|
|
||||||
with app.test_request_context():
|
with app.test_request_context():
|
||||||
rv = flask.send_file(
|
rv = flask.send_file('static/index.html', as_attachment=True, attachment_filename=u'Ñandú/pingüino.txt')
|
||||||
'static/index.html', as_attachment=True,
|
content_disposition = set(rv.headers['Content-Disposition'].split('; '))
|
||||||
attachment_filename=u'Ñandú/pingüino.txt'
|
assert content_disposition == set((
|
||||||
)
|
'attachment',
|
||||||
value, options = parse_options_header(
|
'filename="Nandu/pinguino.txt"',
|
||||||
rv.headers['Content-Disposition']
|
"filename*=UTF-8''%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt"
|
||||||
)
|
))
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
||||||
assert value == 'attachment'
|
|
||||||
assert sorted(options.keys()) == ('filename', 'filename*')
|
|
||||||
assert options['filename'] == 'Nandu/pinguino.txt'
|
|
||||||
assert options['filename*'] == 'UTF-8''%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt'
|
|
||||||
|
|
||||||
def test_static_file(self):
|
def test_static_file(self):
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
# default cache timeout is 12 hours
|
# default cache timeout is 12 hours
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue