diff --git a/middleware/408.js b/middleware/408.js index fd577fb2..2b2a7b8a 100644 --- a/middleware/408.js +++ b/middleware/408.js @@ -2,7 +2,7 @@ // handle time out errors function middleware(err, req, res, next) { res.header('Cache-Control','no-cache'); - if( res.statusCode === 408 ){ + if( res.statusCode === 408 || (err.message.toLowerCase().indexOf('request timeout') !== -1) ){ res.status(408); res.json({ error: err && typeof err.message === 'string' ? err.message : 'request time out' }); } else {