refactor make_response to be easier to follow

* be explicit about how tuples are unpacked
* allow bytes for status value
* allow Headers for headers value
* use TypeError instead of ValueError
* errors are more descriptive
* document that view must not return None
* update documentation about return values
* test more response types
* test error messages

closes #1676
This commit is contained in:
David Lord 2017-04-24 14:11:49 -07:00
parent 46f83665ef
commit 697f7b9365
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 203 additions and 106 deletions

View file

@ -29,6 +29,9 @@ Major release, unreleased
handled by the app's error handlers. (`#2254`_)
- Blueprints gained ``json_encoder`` and ``json_decoder`` attributes to
override the app's encoder and decoder. (`#1898`_)
- ``Flask.make_response`` raises ``TypeError`` instead of ``ValueError`` for
bad response types. The error messages have been improved to describe why the
type is invalid. (`#2256`_)
.. _#1489: https://github.com/pallets/flask/pull/1489
.. _#1898: https://github.com/pallets/flask/pull/1898
@ -36,6 +39,7 @@ Major release, unreleased
.. _#2017: https://github.com/pallets/flask/pull/2017
.. _#2223: https://github.com/pallets/flask/pull/2223
.. _#2254: https://github.com/pallets/flask/pull/2254
.. _#2256: https://github.com/pallets/flask/pull/2256
Version 0.12.1
--------------