Flask Response vs Flask make_response
make_response()
gives you a convenience interface, one that will take arguments in more formats than the flask.Response()
object takes.
In addition, make_response()
uses the Flask.response_class
attribute (so app.response_class
) to build the response. The default value for Flask.response_class
is flask.Response
, but you can set this value to a subclass instead.
So you should really always use make_response()
, rather than use flask.Response()
directly, especially if you want to support swapping out what Response
class you actually use for responses.
You may have to use app.response_class
directly if it is a subclass that takes arguments that make_response()
can't supply.