Skip to content

Commit

Permalink
fix: accept validateOnGeneration param in req.csrfToken
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgonmar committed Nov 5, 2023
1 parent cbedbab commit 0d6187a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ export function doubleCsrf({
};

const doubleCsrfProtection: doubleCsrfProtection = (req, res, next) => {
req.csrfToken = (overwrite?: boolean) => generateToken(req, res, overwrite);
req.csrfToken = (overwrite?: boolean, validateOnGeneration?: boolean) =>
generateToken(req, res, overwrite, validateOnGeneration);
if (ignoredMethodsSet.has(req.method as RequestMethod)) {
next();
} else if (validateRequest(req)) {
Expand Down

0 comments on commit 0d6187a

Please sign in to comment.