forked from orbit-oss/flask
add Response.max_cookie_size config
This commit is contained in:
parent
465b48ed4e
commit
1ed756a523
6 changed files with 65 additions and 5 deletions
|
|
@ -305,6 +305,7 @@ class Flask(_PackageBoundObject):
|
|||
'JSONIFY_PRETTYPRINT_REGULAR': False,
|
||||
'JSONIFY_MIMETYPE': 'application/json',
|
||||
'TEMPLATES_AUTO_RELOAD': None,
|
||||
'MAX_COOKIE_SIZE': 4093,
|
||||
})
|
||||
|
||||
#: The rule object to use for URL rules created. This is used by
|
||||
|
|
|
|||
|
|
@ -191,9 +191,26 @@ class Response(ResponseBase, JSONMixin):
|
|||
.. versionchanged:: 1.0
|
||||
JSON support is added to the response, like the request. This is useful
|
||||
when testing to get the test client response data as JSON.
|
||||
|
||||
.. versionchanged:: 1.0
|
||||
|
||||
Added :attr:`max_cookie_size`.
|
||||
"""
|
||||
|
||||
default_mimetype = 'text/html'
|
||||
|
||||
def _get_data_for_json(self, cache):
|
||||
return self.get_data()
|
||||
|
||||
@property
|
||||
def max_cookie_size(self):
|
||||
"""Read-only view of the :data:`MAX_COOKIE_SIZE` config key.
|
||||
|
||||
See :attr:`~werkzeug.wrappers.BaseResponse.max_cookie_size` in
|
||||
Werkzeug's docs.
|
||||
"""
|
||||
if current_app:
|
||||
return current_app.config['MAX_COOKIE_SIZE']
|
||||
|
||||
# return Werkzeug's default when not in an app context
|
||||
return super(Response, self).max_cookie_size
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue