tough-cookie
Advanced tools
Comparing version 0.9.7 to 0.9.8
@@ -519,3 +519,10 @@ /* | ||
function Cookie() { } | ||
function Cookie (opts) { | ||
if (typeof opts !== "object") return; | ||
Object.keys(opts).forEach(function (key) { | ||
if (Cookie.prototype.hasOwnProperty(key)) { | ||
this[key] = opts[key] || Cookie.prototype[key]; | ||
} | ||
}.bind(this)); | ||
} | ||
@@ -696,3 +703,4 @@ Cookie.parse = parse; | ||
var memstore; | ||
function CookieJar(store) { | ||
function CookieJar(store, rejectPublicSuffixes) { | ||
if (rejectPublicSuffixes != null) this.rejectPublicSuffixes = rejectPublicSuffixes; | ||
if (!store) { | ||
@@ -699,0 +707,0 @@ memstore = memstore || require('./memstore'); |
@@ -6,3 +6,3 @@ { | ||
"keywords": "HTTP cookie cookies set-cookie cookiejar jar RFC6265 RFC2965", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"homepage": "https://github.com/goinstant/node-cookie", | ||
@@ -9,0 +9,0 @@ "repository": { |
@@ -157,2 +157,7 @@ [RFC6265](http://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js | ||
Construction([{options}]) | ||
------------ | ||
Receives an options object that can contain any Cookie properties, uses the default for unspecified properties. | ||
.toString() | ||
@@ -225,3 +230,3 @@ ----------- | ||
Construction | ||
Construction([store = new MemoryCookieStore()][, rejectPublicSuffixes]) | ||
------------ | ||
@@ -231,2 +236,3 @@ | ||
Attributes | ||
@@ -347,3 +353,2 @@ ---------- | ||
* Release to NPM | ||
* _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()` | ||
@@ -350,0 +355,0 @@ * the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891 |
25
test.js
@@ -1165,2 +1165,27 @@ /* | ||
} | ||
}).addBatch({ | ||
"Constructor":{ | ||
topic: function () { | ||
return new Cookie({ | ||
key: 'test', | ||
value: 'b', | ||
maxAge: 60 | ||
}); | ||
}, | ||
'check for key property': function (c) { | ||
assert.ok(c); | ||
assert.equal(c.key, 'test'); | ||
}, | ||
'check for value property': function (c) { | ||
assert.equal(c.value, 'b'); | ||
}, | ||
'check for maxAge': function (c) { | ||
assert.equal(c.maxAge, 60); | ||
}, | ||
'check for default values for unspecified properties': function (c) { | ||
assert.equal(c.expires, "Infinity"); | ||
assert.equal(c.secure, false); | ||
assert.equal(c.httpOnly, false); | ||
} | ||
} | ||
}).export(module); |
254592
2586
378