tough-cookie
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -94,3 +94,3 @@ var tough = require('./cookie'); | ||
MemoryCookieStore.prototype.removeCookies = function removeCookies(domain, path, cb) { | ||
if (!this.idx[domain]) { | ||
if (this.idx[domain]) { | ||
if (path) { | ||
@@ -97,0 +97,0 @@ delete this.idx[domain][path]; |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"homepage": "https://github.com/goinstant/node-cookie", | ||
@@ -19,0 +19,0 @@ "repository": { |
43
test.js
@@ -1411,2 +1411,45 @@ /* | ||
}) | ||
.addBatch({ | ||
"remove cookies": { | ||
topic: function() { | ||
var jar = new CookieJar(); | ||
var cookie = Cookie.parse("a=b; Domain=example.com; Path=/"); | ||
var cookie2 = Cookie.parse("a=b; Domain=foo.com; Path=/"); | ||
var cookie3 = Cookie.parse("foo=bar; Domain=foo.com; Path=/"); | ||
jar.setCookie(cookie, 'http://example.com/index.html', function(){}); | ||
jar.setCookie(cookie2, 'http://foo.com/index.html', function(){}); | ||
jar.setCookie(cookie3, 'http://foo.com/index.html', function(){}); | ||
return jar; | ||
}, | ||
"all from matching domain": function(jar){ | ||
jar.store.removeCookies('example.com',null, function(err) { | ||
assert(err == null); | ||
jar.store.findCookies('example.com', null, function(err, cookies){ | ||
assert(err == null); | ||
assert(cookies != null); | ||
assert(cookies.length === 0, 'cookie was not removed'); | ||
}); | ||
jar.store.findCookies('foo.com', null, function(err, cookies){ | ||
assert(err == null); | ||
assert(cookies != null); | ||
assert(cookies.length === 2, 'cookies should not have been removed'); | ||
}); | ||
}); | ||
}, | ||
"from cookie store matching domain and key": function(jar){ | ||
jar.store.removeCookie('foo.com', '/', 'foo', function(err) { | ||
assert(err == null); | ||
jar.store.findCookies('foo.com', null, function(err, cookies){ | ||
assert(err == null); | ||
assert(cookies != null); | ||
assert(cookies.length === 1, 'cookie was not removed correctly'); | ||
assert(cookies[0].key === 'a', 'wrong cookie was removed'); | ||
}); | ||
}); | ||
} | ||
} | ||
}) | ||
.export(module); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
269634
2883
1