Improve technique for finding cookie set by function.
Instead of iterating through all the outgoing headers.
This commit is contained in:
parent
be0fca729f
commit
55e1281774
1 changed files with 2 additions and 4 deletions
|
@ -70,10 +70,8 @@ class SessionManager:
|
||||||
|
|
||||||
# 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.
|
||||||
for (headerkey, value) in response.headers:
|
function_cookies = response.headers.get_all('Set-Cookie')
|
||||||
if headerkey == 'Set-Cookie' and value.startswith('etiquette_session='):
|
if not any('etiquette_session=' in cookie for cookie in function_cookies):
|
||||||
break
|
|
||||||
else:
|
|
||||||
response.set_cookie(
|
response.set_cookie(
|
||||||
'etiquette_session',
|
'etiquette_session',
|
||||||
value=session.token,
|
value=session.token,
|
||||||
|
|
Loading…
Reference in a new issue