connect-es icon indicating copy to clipboard operation
connect-es copied to clipboard

Listens to response close event for aborted request trigger on http 1

Open lourd opened this issue 6 months ago • 0 comments

Fixes #1025.

This breaks some backwards compatibility. Up until now the "aborted" state of the request was always set as soon as the body of the request had been read. This is undesired, buggy behavior, as #1025 documents. For any applications using the abort controller's signal, they would be aborted every time!

The Node.js documentation on the request close event is misleading at best, inaccurate at worst, as discussed in https://github.com/nodejs/node/issues/40775. Nevertheless, listening to the close event of the response for aborted client requests is the functionally correct implementation. For example, see New Relic changing their instrumentation library to do so https://github.com/newrelic/node-newrelic/pull/1510

The exported universalRequestFromNodeRequest function now requires the response parameter as well.

lourd avatar Aug 22 '24 06:08 lourd