Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
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