chimurai / http-proxy-middleware

:zap: The one-liner node.js http-proxy middleware for connect, express, next.js and more
MIT License
10.7k stars 834 forks source link

fix(error handler): add default handler to econnreset #759

Closed chimurai closed 2 years ago

chimurai commented 2 years ago

Description

Add default handler to http-proxy econnreset event.

This event is not documented in official documentation: https://github.com/http-party/node-http-proxy#listening-for-proxy-events

It is typed in: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e626d3221693ea35ae4298bc8192ac4abebd225f/types/http-proxy/index.d.ts#L109

Event is emitted: https://github.com/http-party/node-http-proxy/blob/9b96cd725127a024dabebec6c7ea8c807272223d/lib/http-proxy/passes/web-incoming.js#L158

Motivation and Context

Lack of this handler potentially causes server to crash (unconfirmed, difficult to replicate)

How has this been tested?

hotfix 🤞

Types of changes

Checklist:

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.3%) to 98.584% when pulling 20988a235628c863358f9dcd4cd9797953f6c2a3 on econnreset into 4baae769e46914299240d4c3ddd59019ba1520bd on 2.x.