* Middleware overhaul! - Remove unnecessary 'async' keywords from middleware functions - Ensure all middleware functions we create have names - Wrap the method contents of all async middleware functions in a try-catch+next(error) pattern * Use asyncMiddleware wrapper instead of try-catch+next(error) pattern * Remove unnecessary try-catch+next(error) pattern from context middleware
9 lines
197 B
JavaScript
9 lines
197 B
JavaScript
module.exports = function handleCSRFError (error, req, res, next) {
|
|
// If the CSRF token is bad
|
|
if (error.code === 'EBADCSRFTOKEN') {
|
|
return res.sendStatus(403)
|
|
}
|
|
|
|
return next(error)
|
|
}
|