view functions can return generators as responses directly

This commit is contained in:
pgjones 2022-06-09 09:30:21 +01:00 committed by David Lord
parent 7f2a0f4806
commit 762382e436
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
5 changed files with 48 additions and 2 deletions

View file

@ -1276,6 +1276,11 @@ def test_make_response(app, req_ctx):
assert rv.data == b"W00t"
assert rv.mimetype == "text/html"
rv = flask.make_response(c for c in "Hello")
assert rv.status_code == 200
assert rv.data == b"Hello"
assert rv.mimetype == "text/html"
def test_make_response_with_response_instance(app, req_ctx):
rv = flask.make_response(flask.jsonify({"msg": "W00t"}), 400)