Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Standardize access to cookie headers #4

Closed

Description

@blittle

As outlined at WHATWG/fetch there is often the need in a server environment to access cookie headers.

For example editing Cookie headers:

const h = new Headers;
h.append("Set-Cookie", "a=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT");
h.append("Set-Cookie", "b=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT");

h.get("Set-Cookie")
// a=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT, b=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT

Headers.prototype.getAll would solve this problem, but was removed from the browser specification. Should we standardize on adding it back? Or should we define a new method all together? Ideally we should align with node-fetch and undici as well.

Activity

  1. KhafraDev commented on May 15, 2022

    @KhafraDev

    There's a proposal to add cookieStore options to the Request and Response constructors. That could solve cookie handling issues if it's automatically propagated with any set-cookie headers. Of course, fetch implementations could also add .getAll('set-cookie') (similar to what cf workers has) and let the dev create their own CookieStore if they need to parse the cookies.

    => CookieStore spec

  2. lucacasonato commented on May 17, 2022

    @lucacasonato
    Member

    This is already being solved in the upstream fetch spec: whatwg#1346.

  3. jimmywarting commented on Jun 14, 2022

    @jimmywarting

    just popping in this little side note: whatwg#1384 if a CookieStore could maybe perhaps serve as an alternative solution. of sending/reading cookies

  4. transferred this issue fromon Jan 19, 2023
  5. andreubotella commented on Aug 17, 2023

    @andreubotella
    Member

    Indeed, with the addition to getSetCookie to upstream fetch in whatwg#1346, and this fork allowing server-side runtimes to not filter cookie headers in #19, I think this issue can now be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions