Cookie not added to cookieJar because of silent error
See original GitHub issueSummary
It should be convenient to be able to customize RequestJar.setCookie()
options, I wanted to debug why a cookie wasn’t collected, and that was apparently because of the following error:
Error: Cookie has domain set to a public suffix
at CookieJar.setCookie (/projects/veggies/node_modules/tough-cookie/lib/cookie.js:933:13)
at CookieJar.setCookieSync (/projects/veggies/node_modules/tough-cookie/lib/cookie.js:1305:18)
at RequestJar.setCookie (/projects/veggies/node_modules/request/lib/cookies.js:28:20)
I had to manually change the way cookies are parsed to actually understand why the cookie were ignored:
// /projects/veggies/node_modules/request/request.js l. 979
targetCookieJar.setCookie(cookie, self.uri.href, {ignoreError: false})
Expected Behavior
Error is raised when I want to.
Current Behavior
Cookie is not set in cookie jar and I have no clue on why it’s not.
Possible Solution
Add ability to pass option to not ignore errors.
Context
I’m trying to get response cookies for a lib I’m writing to help testing APIs using cucumber js, https://github.com/ekino/veggies.
My Environment
software | version |
---|---|
request | 2.81.0 |
node | 7.6.0 |
yarn | 0.24.5 |
Operating System | OSX 10.12.2 |
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Error when loading cookies into a Python request session
Cookie. The Cookie HTTP request header contains stored HTTP cookie previously sent by the server with the Set-Cookie header. A HTTP cookie ......
Read more >http.cookiejar — Cookie handling for HTTP clients — Python ...
A CookieJar which can load cookies from, and perhaps save cookies to, a file on disk. Cookies are NOT loaded from the named...
Read more >tough-cookie - npm
creation - Date - modified from construction to when the cookie was added to the jar. lastAccessed - Date - last time the...
Read more >tough-cookie
12, the allPaths option to cookiejar.getCookies() above will cause the path here to be null . If the path is null , path-matching...
Read more >22242 (Setting cookie that is too large fails silently)
I could fix this myself, but I would like to hear other's opinions on this, because cookie size limit varies between the browsers,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve found a workaround to fix my current issue, however it does not change the fact errors should be enabled.
Also accessing internal implementation should be avoided.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.