Skip to content

Commit

Permalink
fix: tests, only generate csrf_token on 404 gets
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Feb 9, 2021
1 parent 2c52fbd commit b6493f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/controllers/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ exports.send404 = async function (req, res) {
if (res.locals.isAPI) {
return res.json({ path: validator.escape(path.replace(/^\/api/, '')), title: '[[global:404.title]]' });
}
await middleware.applyCSRFasync(req, res);

if (req.method === 'GET') {
await middleware.applyCSRFasync(req, res);
}

await middleware.buildHeaderAsync(req, res);
res.render('404', { path: validator.escape(path), title: '[[global:404.title]]' });
};

0 comments on commit b6493f8

Please sign in to comment.