Skip to content

Commit

Permalink
Fix an issue I made and fix a bug
Browse files Browse the repository at this point in the history
remove the ! I added from the last commit, and default req.cookies to an empty JSON value when there are no cookies
  • Loading branch information
ironswordX committed Sep 9, 2023
1 parent 54242c3 commit 53e71f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ function cookieParser (secret, options) {
: [secret]

return function cookieParser (req, res, next) {
if (!req.cookies) {
if (req.cookies) {
//so i am assuming this is if req.cookies has been set by another middleware
next();
return;
}

var cookies = req.headers.cookie

req.secret = secrets[0]
Expand All @@ -55,7 +56,8 @@ function cookieParser (secret, options) {

// no cookies
if (!cookies) {
next()
req.cookies = {}
next();
return;
}

Expand Down

0 comments on commit 53e71f1

Please sign in to comment.