Browse Source

check for err message if it contains the words request timeout (because sometimes it comes back as a 500 even though it should be 408)

pull/160/head
Harish Krishna 10 years ago
parent
commit
6c55bdc5bf
  1. 2
      middleware/408.js

2
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 {

Loading…
Cancel
Save