Skip to content

Koa should strip quotes for returned cookie values #1561

@naruaway

Description

@naruaway

Some web framework sometimes uses "quoted-string" as defined in RFC 2965 as a cookie value and it causes web browsers to send a header like Cookie: my_value_a=x; my_value_b="abc:def:xyz";.

In this case, ctx.cookies.get("my_value_b") returns "abc:def:xyz" rather than abc:def:xyz (no quotes), which is not developer friendly and error-prone when dealing with cookies from other web frameworks.

Since both Django and Express are automatically stripping quotes under the hood (see this PR for details), I think koa should also automatically strip quotes for cookie values.

Possible solutions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions