Skip to content

Commit f73e049

Browse files
committed
lib: fix duplexes causing issue
1 parent 1003868 commit f73e049

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/internal/webstreams/adapters.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ function newWritableStreamFromStreamWritable(streamWritable) {
101101
// here because it will return false if streamWritable is a Duplex
102102
// whose writable option is false. For a Duplex that is not writable,
103103
// we want it to pass this check but return a closed WritableStream.
104-
const checkIfWritable =
104+
// We check if the given stream is a stream.Writable or http.OutgoingMessage
105+
const checkIfWritableOrOutgoingMessage =
105106
streamWritable &&
106107
typeof streamWritable?.write === 'function' &&
107-
typeof streamWritable?.on === 'function' &&
108-
!streamWritable?._readableState;
109-
if (!checkIfWritable) {
108+
typeof streamWritable?.on === 'function';
109+
if (!checkIfWritableOrOutgoingMessage) {
110110
throw new ERR_INVALID_ARG_TYPE(
111111
'streamWritable',
112112
'stream.Writable',

0 commit comments

Comments
 (0)