-
Notifications
You must be signed in to change notification settings - Fork 15k
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
Cookie handling in net module #8891
Comments
The behavior was initially to save and send cookies from the cookie store. This was changed due to #8223 . Thinking back on it, we should expose
/cc @zcbenz @kevinsawicki thoughts ? |
I can't figure out how to send a cookie with net.request. Since it doesn't send it automatically, I am trying to set a header like this:
When I try to send that HTTP request I get a runtime error saying "Error processing argument at index 1, conversion failure from [object Array]" So what type should the cookies header be set to? |
@rajbala Yes, you have to use cookieJar
.getCookiesSync(url, { allPaths: true })
.map(cookie => cookie.cookieString())
.join('; ')
|
Tried to get around this using ToughCookie and isomorphic-fetch.
And cookies are still not being passed in subsequent requests. I use the above to handle cookies for Jest in a react-native project. Current version of Electron (1.7) |
@jayesbe I'm preaching for my choir here, but take a look at https://www.npmjs.com/package/electron-fetch , and arantes555/electron-fetch#3 (comment) . It's not as elegant as having it all automated, but it works |
We are no longer implementing bugfixes for versions of Electron <= |
@codebytere reproducible with provided project on 1.8.8, 2.0.10, 3.0.0. |
I can confirm, the bug is still present on newer electron versions |
Great! Thanks for the fast response. |
Thank you for taking the time to report this issue and helping to make Electron better. The version of Electron you reported this on has been superseded by newer releases. If you're still experiencing this issue in Electron v4.2.x or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know. I'm setting the Thanks in advance! Your help is appreciated. |
@sofianguy I can confirm the issue still happens with all newer major electron versions. I have tested:
And the issue still happens with all these versions. I have of course updated the repo with a commit for each electron version. |
I confirm the problem still happens on electron@6.1.3 and electron@7.0.1. The repo has been updated accordingly. |
I'm labeling this as a feature instead of bug since this would be a breaking change. |
Expected behavior
Requests sent with the net module should behave one of two ways regarding cookies.
set-cookie
header, and send them back when necessary, automatically (with the possibility of an option to disable this behaviour)Actual behavior
Requests sent with the net module store cookies in the Session used by the request when getting a
set-cookie
header, but do not send them back afterwards.How to reproduce
output:
Btw, if I'm reporting multiple issues with the net module these days, it's because I'm working on https://github.com/arantes555/electron-fetch , if you wanna take a look :)
The text was updated successfully, but these errors were encountered: