Skip to content

Commit

Permalink
add logging to see what is going wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
ironswordX committed Sep 9, 2023
1 parent e886961 commit b04b2fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,27 @@ function cookieParser (secret, options) {
: [secret]

return function cookieParser (req, res, next) {
console.log(1)
if (req.cookies) {
next();
return;
}
console.log(2)

var cookies = req.headers.cookie

req.secret = secrets[0]
req.cookies = Object.create(null)
req.signedCookies = Object.create(null)
console.log(3)

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

req.cookies = cookie.parse(cookies, options)

Expand All @@ -67,6 +71,7 @@ function cookieParser (secret, options) {
req.signedCookies = signedCookies(req.cookies, secrets)
req.signedCookies = JSONCookies(req.signedCookies)
}
console.log(5)

// parse JSON cookies
req.cookies = JSONCookies(req.cookies)
Expand Down

0 comments on commit b04b2fc

Please sign in to comment.