63d3663466
There is a single timeout option which applies to both the receiving of response headers and the receiving of the entire response body. Once the response is received, the socket timeout must be cleared to allow the timeout to apply to the receiving of the entire response body. Without clearing the socket timeout, if the nearing the idle timeout when the Promise for the body is created, then the request's timeout handler will abort the request, emitting ERR_STREAM_PREMATURE_CLOSE in the body Promise. By clearing the socket timeout once the response headers are received, the timeout for the entire body can be started when the body is awaited. Since the request will no longer be aborted by the socket timeout, destroy is called on the body to prevent it continuing to emit data events. |
||
---|---|---|
.. | ||
chai-timeout.js | ||
delay.js | ||
dummy.txt | ||
server.js |