-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cookies apparently not preserved across agent requests #1164
Comments
We have tests for it and they pass: Do you do something differently from these tests? (e.g. check contents of the header to see if domains/paths/secure flags make sense) |
Here is a full test: cookieTest.js
login2.js
dependencies:
mocha installed globally Run: SERVER_UNDER_TEST=https://www.yahoo.com mocha cookieTest |
I'm unable to reproduce it with the latest version of superagent
|
Hmmm. Rechecking my dependencies, I have:
$ SERVER_UNDER_TEST=https://www.yahoo.com mocha cookieTest Cookie Test 1 passing (1s) |
I can provide you with the network log. That might help. |
Yes, request and response HTTP headers would clear things up |
Firstrequest:GET / HTTP/1.1 response:
second:request:GET / HTTP/1.1 response:
|
This looks correct. Yahoo does not set any cookies, it removes one: |
Alright, trying again; this time I'm wondering if the expires data (Nov. 19, 1981) is being interpreted as applying to the cookie as well as the rest of the response? I believe that should only apply to the response body (although the past date suggests a config issue). There's no expires date on the cookie, so it should be maintained for the session....browsers are treating the cookie this way. first request:GET /reskin/xml/headers.php/ HTTP/1.1 first response:HTTP/1.1 200 OK second request:Accept-Encoding:gzip, deflate second response:HTTP/1.1 200 OK |
I've checked. This is because superagent doesn't know what the domain name is. You're requesting
I guess superagent-prefix is a leaky abstraction. You could report the problem there. |
I'm using superagent-prefix, which I assumed prefixed the server name to the get path. However, if I don't use superagent-prefix and specify the full path (https://www.mavericklabel.com/reskin/xml/headers.php), then the test passes. Alright, good enough. Thanks. |
I have a typical login scenario which returns a session id. The second login test fails because another 'set-cookie' is in the header.
I can get this to work in supertest, which uses an older version of superagent, by calling
res.jar.setCookie(res.headers['set-cookie'][0])
in the first request.The text was updated successfully, but these errors were encountered: