Use flasktools.ensure_response_type.

master
voussoir 2021-06-04 21:28:23 -07:00
parent d091efb619
commit 1554b86c11
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
2 changed files with 1 additions and 2 deletions

View File

@ -65,6 +65,7 @@ def decorate_and_route(*route_args, **route_kwargs):
# Since a function might have multiple routes, we may be seeing the # Since a function might have multiple routes, we may be seeing the
# same one multiple times. The _fully_decorated will track that. # same one multiple times. The _fully_decorated will track that.
if not hasattr(endpoint, '_fully_decorated'): if not hasattr(endpoint, '_fully_decorated'):
endpoint = flasktools.ensure_response_type(endpoint)
endpoint = decorators.catch_etiquette_exception(endpoint) endpoint = decorators.catch_etiquette_exception(endpoint)
endpoint = session_manager.give_token(endpoint) endpoint = session_manager.give_token(endpoint)

View File

@ -79,8 +79,6 @@ class SessionManager:
session.maintain() session.maintain()
response = function(*args, **kwargs) response = function(*args, **kwargs)
if not isinstance(response, flasktools.RESPONSE_TYPES):
response = flask.Response(response)
# Send the token back to the client # Send the token back to the client
# but only if the endpoint didn't manually set the cookie. # but only if the endpoint didn't manually set the cookie.