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
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:
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.
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
The text was updated successfully, but these errors were encountered:
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 toCookieAccessInfo
, which currently isn't exposed by Superagent.Currently, the way to work around this would be to import
cookiejar
in our own code, however: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 breakCookieAccessInfo.All
because it's used like a symbol.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 wholecookiejar
module) be exposed somewhere? Maybe as a static property ofAgent
? Then we could dosuperagent.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
The text was updated successfully, but these errors were encountered: