-
Notifications
You must be signed in to change notification settings - Fork 113
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
expect cookie fails with a proper set-cookie header #43
Comments
I'm also having issues this when trying to use This assertion is failing: Here is a subset of my
I'm using version |
Thanks for the issue @arnaugm. Could you please provide the same info @Limess has - to help us diagnose this problem? @Limess - in your case, it looks as though because you have set the The way I see it - we have two fixes:
|
Sorry @keithamus I don't have access to that code any more, it was long ago. I'll let you know if I face the problem again. |
Ah yes I see now, sorry I don't know how I missed your original comment - I only just got a notification from @Limess' comment. It was likely a similar problem, it seems like |
Hey all, I'm marking this as PR wanted, as bmeck/node-cookiejar#24 has been fixed and we're using 2.1.0 of cookiejar, so we can fix this issue. It should be a case of changing http.js#L346 from cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo()); to cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo.All); and then of course, adding tests in our test/http.js file. |
I'm having a look at fixing this issue but I'm not 100% sure I understand how the issue is caused. Is it due to the fact that there are spaces in the cookie string? eg . So in the tests I've changed var req = {
headers: {
'cookie': ['name=value;name2=value2;']
}
}; to var req = {
headers: {
'cookie': ['name=value;name2=value2; name3=value3;']
}
}; and am working on the assumption that I should be asserting the existence of the new |
@leggsimon the issue is that a cookie like this: 'some_cookie=defgh-abcde; Domain=.someurl.co.uk; Path=/; Expires=Tue, 23 Feb 2016 10:35:16 GMT; HttpOnly' Which has a domain ( cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo());
cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo('.someurl.co.uk')); Then we could read all cookies with a cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo.All); So, in the cookie tests, where we setup the req object (test/http.js#L271-278, if we add a new cookie with a domain: var res = {
headers: {
'set-cookie': [
'name=value',
'name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT',
'name3=value3; Domain=somedomain.co.uk',
]
}
}; And we assert that we can get the cookie: res.should.have.cookie('name3', 'value3'); When we run these tests against existing code, we should see them fail. However if we change that line (the |
Riiiiight ok. Thanks @keithamus I think I need to have a look into and understand |
Apologies for the delay in getting to this, but a quick update: It seems as though it isn't as straightforward as your suggestion @keithamus. |
@leggsimon I have been banished from the FT Slack, exiled to a far away land. I hang out on the official Chai and though. Feel free to DM on either one 😄 |
In a test I'm making some expectations on the response. One of the expectations verifies the existence of a cookie in the form:
The expectation fails while the response object contains the set-cookie header with the cookie.
Using v1.0.0
The text was updated successfully, but these errors were encountered: