dvonlehman / express-request-proxy

Advanced streaming http request proxy middleware for Express with support for custom routes, caching, and response transforms.
95 stars 38 forks source link

Abort api request when first request is cancelled #34

Closed lionep closed 6 years ago

lionep commented 6 years ago

Call the abort method of the request object when main request is canceled.

This is useful when express-request-proxy is used to proxify long polling requests.
In the polling mode of socket.io, when a client disconnects, the long polling request is canceled, but the proxified request persists between the middleware and the remote server.
The remote server sees the client as connected until the request timeouts.

lionep commented 6 years ago

Hi @dvonlehman Any chance to merge this PR ?

lionep commented 6 years ago

Thanks, I just add a unit test to check that a request with a body spawn only one request.

dvonlehman commented 6 years ago

@lionep this has been published to npm as version 2.2.0.

lionep commented 6 years ago

Thank you !