Skip to content

Commit

Permalink
Preventing the fail of the 'ETIMEDOUT' code in 500 'Internal server e…
Browse files Browse the repository at this point in the history
…rror' (chimurai#480)

Thanks for this PR!
  • Loading branch information
aremishevsky authored and sarumont committed Jan 12, 2021
1 parent a1fc2d8 commit 0e53e4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function defaultErrorHandler(err, req, res) {
case 'ECONNRESET':
case 'ENOTFOUND':
case 'ECONNREFUSED':
case 'ETIMEDOUT':
res.writeHead(504);
break;
default:
Expand Down
1 change: 1 addition & 0 deletions test/unit/handlers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ describe('default proxy error handler', () => {
['ECONNREFUSED', 504],
['ENOTFOUND', 504],
['ECONNREFUSED', 504],
['ETIMEDOUT', 504],
['any', 500],
];

Expand Down

0 comments on commit 0e53e4f

Please sign in to comment.