Closed mrdc closed 2 years ago
{'Set-Cookie':'username=Test', 'Set-Cookie':'logged=true'}
The declared header is a dictionary dict
, the behavior of a dictionary is to have unique keys, the way you do this is overwriting the Set-Cookie
index.
If you use the response.set_cookie
function to declare multiple cookies
The headers
parameter also accepts a list of key/value pairs instead of a dict if you need multiple values for the same header.
Hello!
I'm trying to set multiple cookies in HTTPResponse and it looks like it's not possible. This code returns the last cookie (which is expected as it's dict, so keys should be unique):
Manually setting headers in response works fine, but without using HTTPResponse, because it ignores any manually set headers.