1
0
mirror of synced 2025-12-21 10:57:10 -05:00

Improve performance of csrf errors (#16136)

* Improve performance of csrf errors

* Fix handle csrf error middleware

Co-authored-by: Chiedo <chiedo@users.noreply.github.com>
This commit is contained in:
Chiedo John
2020-10-20 11:42:05 -04:00
committed by GitHub
parent c6490230fa
commit 9f10fdd033
3 changed files with 9 additions and 5 deletions

View File

@@ -0,0 +1,8 @@
module.exports = async function handleCSRFError (error, req, res, next) {
// If the CSRF token is bad
if (error.code === 'EBADCSRFTOKEN') {
return res.sendStatus(403)
}
return next(error)
}