Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Expose CookieAccessInfo from cookiejar in Node #1683

Open
noinkling opened this issue Feb 7, 2022 · 0 comments
Open

[Feature request] Expose CookieAccessInfo from cookiejar in Node #1683

noinkling opened this issue Feb 7, 2022 · 0 comments

Comments

@noinkling
Copy link

noinkling commented Feb 7, 2022

In Node, we have access to an Agent's cookie jar on the .jar property, but in order to retrieve cookies from it (useful in certain cases including testing) we also need access to CookieAccessInfo, which currently isn't exposed by Superagent.

Currently, the way to work around this would be to import cookiejar in our own code, however:

  1. Having an implicit dependency is a bad idea, not least because there's no guarantee that we'll get the version of cookiejar that Superagent is using. A different version is not guaranteed to be compatible, and at the very least it would break CookieAccessInfo.All because it's used like a symbol.

  2. If we make the dependency explicit in package.json we have to take care to match the version that Superagent uses, which is annoying and brittle - even then there may not be a strong guarantee that Superagent uses the version we import.

For these reasons, could CookieAccessInfo (or alternatively, the whole cookiejar module) be exposed somewhere? Maybe as a static property of Agent? Then we could do superagent.agent.CookieAccessInfo. Or maybe as a prototype property? Another option is to expose it on the main import, but I'm not sure if that makes sense or not. Or even just a separate file we could import like 'superagent/cookiejar'. If we can work out which one is preferred I'd be happy to throw up a PR myself. I'd also like it to be exposed from Supertest, if that makes any difference.

Previous request from a long time ago that was closed without explanation: #192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant