Skip to content

Add CookieStore #59799

Closed as duplicate
Closed as duplicate

Description

@Richienb

What is the problem this feature will solve?

Storing cookies between HTTP requests.

What is the feature you are proposing to solve the problem?

Re-implementing the CookieStore class as a pure (doesn't actually store cookies globally) Node.js global/exported class. (it is worth noting that new CookieStore() doesn't work in browsers, so this will be Node-exclusive)
Then, userland request libraries can accept a CookieStore instance as an option.

What alternatives have you considered?

  1. Polyfilling the CookieStore instance.
  2. got (userland request library) presently provides server-side cookie support by relying on the functionally-similar tough-cookie. tough-cookie exposes a CookieJar class that manages cookies, and an instance is passed straight to got.

Activity

  1. added
    feature request
    on Sep 7, 2025
  2. jasnell commented on Sep 7, 2025

    @jasnell
    Member

    Implementing CookieStore is fine when node.js is being used as an http client with a single user. It's rather more problematic to implement on the server that is serving multiple users and could be a security issue. If we're going to implement this we need to be absolutely clear that there will be no globalThis.cookieStore, and we'd need to make sure that it's not something that gets added later just for "spec compliance".

  3. Richienb commented on Sep 7, 2025

    @Richienb
    ContributorAuthor

    there will be no globalThis.cookieStore

    Yes, the class should be side effect-free. 👍🏻

    I'm also happy even if it gets added as something exported by http, for example.

  4. jasnell commented on Sep 7, 2025

    @jasnell
    Member

    @nodejs/undici ... this is probably something that could be done as part of undici?

  5. Delapouite commented on Sep 7, 2025

    @Delapouite
    Contributor

    Related open issue from 2022 #42183

  6. Uzlopak commented on Sep 7, 2025

    @Uzlopak
    Contributor

    yep, should be part of undici. I recommend to close this issue here.

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

    feature request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions