From 1554b86c119226f84836b096b41fcdadaae88b4d Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 4 Jun 2021 21:28:23 -0700 Subject: [PATCH] Use flasktools.ensure_response_type. --- frontends/etiquette_flask/backend/common.py | 1 + frontends/etiquette_flask/backend/sessions.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frontends/etiquette_flask/backend/common.py b/frontends/etiquette_flask/backend/common.py index c712fe6..e150425 100644 --- a/frontends/etiquette_flask/backend/common.py +++ b/frontends/etiquette_flask/backend/common.py @@ -65,6 +65,7 @@ def decorate_and_route(*route_args, **route_kwargs): # Since a function might have multiple routes, we may be seeing the # same one multiple times. The _fully_decorated will track that. if not hasattr(endpoint, '_fully_decorated'): + endpoint = flasktools.ensure_response_type(endpoint) endpoint = decorators.catch_etiquette_exception(endpoint) endpoint = session_manager.give_token(endpoint) diff --git a/frontends/etiquette_flask/backend/sessions.py b/frontends/etiquette_flask/backend/sessions.py index be0e1cb..db8c5eb 100644 --- a/frontends/etiquette_flask/backend/sessions.py +++ b/frontends/etiquette_flask/backend/sessions.py @@ -79,8 +79,6 @@ class SessionManager: session.maintain() response = function(*args, **kwargs) - if not isinstance(response, flasktools.RESPONSE_TYPES): - response = flask.Response(response) # Send the token back to the client # but only if the endpoint didn't manually set the cookie.