Skip to content

Bug: ResponseDataExtractor merges per cookie attributes #3040

Open
@floxay

Description

@floxay

Description

Currently ResponseDataExtractor merges all values of cookies into a single dictionary, however cookies in the Set-Cookie header can have different flags, paths, domains, etc. set which are currently lost.

URL to code causing the issue

if cookie_string := ";".join(
[x[1].decode("latin-1") for x in filter(lambda x: x[0].lower() == b"set-cookie", messages[0]["headers"])]
):
parsed_cookies = parse_cookie_string(cookie_string)
Test showing how per cookie attributes (all attributes apart from key and value) are combined right now:
assert extracted_data.get("cookies") == {"Path": "/", "SameSite": "lax", "auth": "", "regular": ""}

MCVE

No response

Steps to reproduce

No response

Screenshots

No response

Logs

No response

Litestar Version

v2.5.1

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛This is something that is not working as expected

    Type

    No type

    Projects

    Status

    Working on it

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions