const handleUnauthorizedError = (err, req, res, next) => (
(err.name === 'UnauthorizedError')
? res.status(401).json({ status: 'error', message: 'The token used to make this request is invalid ' })
: next()
)
I want to pass custom err and req, res to this function in order to test in jest. But I don't find any help to send custom req and res to this function.
Aucun commentaire:
Enregistrer un commentaire