Improve technique for finding cookie set by function.

Instead of iterating through all the outgoing headers.
master
voussoir 2018-01-15 18:56:41 -08:00
parent be0fca729f
commit 55e1281774
1 changed files with 2 additions and 4 deletions

View File

@ -70,10 +70,8 @@ class SessionManager:
# Send the token back to the client
# but only if the endpoint didn't manually set the cookie.
for (headerkey, value) in response.headers:
if headerkey == 'Set-Cookie' and value.startswith('etiquette_session='):
break
else:
function_cookies = response.headers.get_all('Set-Cookie')
if not any('etiquette_session=' in cookie for cookie in function_cookies):
response.set_cookie(
'etiquette_session',
value=session.token,