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

URL not filled on cookie jar store after updating to version 2.0.2 #420

Closed
mwohlert opened this issue Oct 13, 2021 · 2 comments · Fixed by #423
Closed

URL not filled on cookie jar store after updating to version 2.0.2 #420

mwohlert opened this issue Oct 13, 2021 · 2 comments · Fixed by #423

Comments

@mwohlert
Copy link

After I updated to version 2.0.2 the urls inside the memorystorage of tough-cookie are all null.

Before update (1.0.1):

const axiosCookieJarSupport = require('axios-cookiejar-support').default;
const { CookieJar } = require('tough-cookie');
....
const cookieJar = new CookieJar();
axios.defaults.jar = cookieJar;
axios.defaults.withCredentials = true;

await axios.get(xxxxx);

Inside the CookieJar:
image

After Update:

const { wrapper } = require('axios-cookiejar-support');
const { CookieJar } = require('tough-cookie');
...
wrapper(axios);
const cookieJar = new CookieJar();
axios.defaults.withCredentials = true;


await axios.get(xxxxx, { jar: cookieJar });

Inside CookieJar:
image

It seems like it is saving the cookie under url "null", so there must be something wrong with accessing the url from axios.

More info:
Nodejs : 12.13.1
Axios: 0.21.4

@3846masa
Copy link
Owner

Thanks for reporting.

I tried it, and it did not work with Node.js v12.13.1.

On the other hand, when I tried it with Node.js v12.22.7 (the latest version of v12), it worked fine.

I'll investigate the cause, but for now, please try using Node.js v12.22.7 or above.

@3846masa
Copy link
Owner

axios-cookiejar-support (http-cookie-agent) will get url via ClientRequest#host, ClientRequest#port, and ClientRequest#path.

https://github.com/3846masa/http-cookie-agent/blob/v1.0.1/src/create_cookie_agent.ts#L54-L58

ClientRequest#host and ClientRequest#port was added in v14.5.0 / v12.19.0.

https://nodejs.org/api/http.html

request.path#
Added in: v0.4.0

request.host
Added in: v14.5.0, v12.19.0

request.protocol
Added in: v14.5.0, v12.19.0

Please use Node.js v14.5.0 / v12.19.0 or above.

3846masa added a commit to 3846masa/http-cookie-agent that referenced this issue Oct 14, 2021
* ClientRequest#host and ClientRequest#port was added in v12.19.0 / v14.5.0
* 3846masa/axios-cookiejar-support#420 (comment)
3846masa added a commit to 3846masa/http-cookie-agent that referenced this issue Oct 14, 2021
* ClientRequest#host and ClientRequest#port was added in v12.19.0 / v14.5.0
* 3846masa/axios-cookiejar-support#420 (comment)
github-actions bot pushed a commit to 3846masa/http-cookie-agent that referenced this issue Oct 14, 2021
3846masa added a commit that referenced this issue Oct 14, 2021
* ClientRequest#host and ClientRequest#port was added in v12.19.0 / v14.5.0
* See #420 (comment)
3846masa added a commit that referenced this issue Oct 14, 2021
* fix: fix supported node version

* ClientRequest#host and ClientRequest#port was added in v12.19.0 / v14.5.0
* See #420 (comment)

* fix(deps): update dependency http-cookie-agent to v1.0.2
github-actions bot pushed a commit that referenced this issue Oct 14, 2021
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

Successfully merging a pull request may close this issue.

2 participants