http-client
http-client copied to clipboard
Streaming send hangs if 'close' event is emitted
If a stream passed to sendStream
or any other of the streaming methods emits a close
event and uses an end
event instead of the end()
method, the send method will hang. This is reproducible by sending a file read stream with emitClose = true
, and is fixed by setting it to false
. Oddly, this does not seem to come up in the artifact or cache toolkit libraries that use this, but I'm passing the stream directly to sendStream
and not doing anything else to it. It can be reproduced by manually sending end
and close
to a PassThrough
stream (in any order) as well. Note that calling end
and emitting close
works fine, it only happens when you emit end
with emit()
instead of calling the method.