Skip to content

Commit d34ae40

Browse files
authored
Merge pull request #128 from leggsimon/fix-cookie-assertion-with-domain
use sentinal value to check cookies with domains
2 parents c469879 + 2ae97dd commit d34ae40

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/http.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ module.exports = function (chai, _) {
343343

344344
cookie = Cookie.CookieJar();
345345
cookie.setCookies(header);
346-
cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo());
346+
cookie = cookie.getCookie(key, Cookie.CookieAccessInfo.All);
347347

348348
if (arguments.length === 2) {
349349
this.assert(

test/http.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,19 @@ describe('assertions', function () {
308308
it('#cookie (request)', function () {
309309
var req = {
310310
headers: {
311-
'cookie': 'name=value;name2=value2;'
311+
'set-cookie': [
312+
'name=value;',
313+
'name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT',
314+
'name3=value3; Domain=.somedomain.com',
315+
]
312316
}
313317
};
314318
req.should.have.cookie('name');
315319
req.should.have.cookie('name2');
320+
req.should.have.cookie('name3');
316321
req.should.have.cookie('name', 'value');
317322
req.should.have.cookie('name2', 'value2');
323+
req.should.have.cookie('name3', 'value3');
318324
req.should.not.have.cookie('bar');
319325
req.should.not.have.cookie('name2', 'bar');
320326

0 commit comments

Comments
 (0)