Skip to content

Commit

Permalink
Merge c4f6159 into 256b4eb
Browse files Browse the repository at this point in the history
  • Loading branch information
smcmurray committed May 20, 2018
2 parents 256b4eb + c4f6159 commit 083707c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Expand Up @@ -65,11 +65,12 @@ Cookies.prototype.get = function(name, opts) {
value = match[1]
if (!opts || !signed) return value

if (!this.keys) throw new Error('.keys required for signed cookies');

remote = this.get(sigName)
if (!remote) return

data = name + "=" + value
if (!this.keys) throw new Error('.keys required for signed cookies');
index = this.keys.index(data, remote)

if (index < 0) {
Expand Down Expand Up @@ -162,7 +163,7 @@ Cookie.prototype.toString = function() {
Cookie.prototype.toHeader = function() {
var header = this.toString()

if (this.maxAge) this.expires = new Date(Date.now() + this.maxAge);
if (this.maxAge || 0 === this.maxAge) this.expires = new Date(Date.now() + this.maxAge);

if (this.path ) header += "; path=" + this.path
if (this.expires ) header += "; expires=" + this.expires.toUTCString()
Expand Down

0 comments on commit 083707c

Please sign in to comment.