1
0
mirror of synced 2025-12-21 02:46:50 -05:00
Files
docs/middleware/handle-csrf-errors.js
Chiedo John 9f10fdd033 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>
2020-10-20 11:42:05 -04:00

9 lines
203 B
JavaScript

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)
}