Skip to content
Myr

Set the content length automatically before calling wrap_file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent ffd9296 · Browse files · 2 files+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+2 added−0 removed

  • other:+2 added−0 removed

2 files+2 added−0 removed

modified:flask/testsuite/basic.py+1 added
784 unmodified lines
785 self.assert_equal(c.get('/1,2,3').data, b'1|2|3')786787 def test_static_files(self):788 app = flask.Flask(__name__)789 app.testing = True790 rv = app.test_client().get('/static/index.html')791 self.assert_equal(rv.status_code, 200)792 self.assert_equal(rv.data.strip(), b'<h1>Hello World!</h1>')793 with app.test_request_context():
358 unmodified lines
modified:flask/helpers.py+1 added
514 unmodified lines
515 else:516 if file is None:517 file = open(filename, 'rb')518 mtime = os.path.getmtime(filename)519 headers['Content-Length'] = os.path.getsize(filename)520 data = wrap_file(request.environ, file)521522 rv = current_app.response_class(data, mimetype=mimetype, headers=headers,523 direct_passthrough=True)
323 unmodified lines