Only look at cookies if they are available

This commit is contained in:
Ritchie Martori 2013-12-11 16:42:47 -08:00
parent 0f4e9e1d1c
commit ad58a8ec13
1 changed files with 6 additions and 5 deletions

View File

@ -174,13 +174,14 @@ function tokenIdForRequest(req, options) {
}
}
for(i = 0, length = headers.length; i < length; i++) {
id = req.signedCookies[cookies[i]];
if(req.signedCookies) {
for(i = 0, length = headers.length; i < length; i++) {
id = req.signedCookies[cookies[i]];
if(typeof id === 'string') {
return id;
if(typeof id === 'string') {
return id;
}
}
}
return null;
}