When reading the doc, I see that when using streams, it is required to call the .end()
method to send the request.
Moreover, if options
contain a body
(or form
, or json
), then the response stream will be read-only.
Note #2: If you provide this option, got.stream() will be read-only.
And if the .end()
method is called while the stream is read-only, it throws.
Is there a way to know that the returned stream is read-only?
(Other than catching this error, or inferring the state of the returned stream based on the passed options)
I would expect the following to work, but apparently writable
is always true.
if (requestStream instanceof stream.Writable && requestStream.writable) {
requestStream.end()
}
I tried to look up in the documentation and existing issues, but couldn't find anything.
Sorry if I missed it.
Also, I'd happy to try to implement something to make the requestStream.writable
false
when it's read-only.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too