You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
Polyfilling the CookieStore instance.
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.
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".
Activity
jasnell commentedon Sep 7, 2025
Implementing
CookieStoreis 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 noglobalThis.cookieStore, and we'd need to make sure that it's not something that gets added later just for "spec compliance".Richienb commentedon Sep 7, 2025
Yes, the class should be side effect-free. 👍🏻
I'm also happy even if it gets added as something exported by
http, for example.jasnell commentedon Sep 7, 2025
@nodejs/undici ... this is probably something that could be done as part of undici?
Delapouite commentedon Sep 7, 2025
Related open issue from 2022 #42183
Uzlopak commentedon Sep 7, 2025
yep, should be part of undici. I recommend to close this issue here.
CookieStoreundici#4525