1
0
mirror of synced 2025-12-21 02:46:50 -05:00

Middleware overhaul! (#18218)

* 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
This commit is contained in:
James M. Greene
2021-03-10 19:12:41 -06:00
committed by GitHub
parent 5f70c4938e
commit c940dcd98b
35 changed files with 96 additions and 85 deletions

View File

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