Skip to content

Commit

Permalink
lib: fix duplexes causing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
debadree25 committed Nov 28, 2022
1 parent 1003868 commit f73e049
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/internal/webstreams/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ function newWritableStreamFromStreamWritable(streamWritable) {
// here because it will return false if streamWritable is a Duplex
// whose writable option is false. For a Duplex that is not writable,
// we want it to pass this check but return a closed WritableStream.
const checkIfWritable =
// We check if the given stream is a stream.Writable or http.OutgoingMessage
const checkIfWritableOrOutgoingMessage =
streamWritable &&
typeof streamWritable?.write === 'function' &&
typeof streamWritable?.on === 'function' &&
!streamWritable?._readableState;
if (!checkIfWritable) {
typeof streamWritable?.on === 'function';
if (!checkIfWritableOrOutgoingMessage) {
throw new ERR_INVALID_ARG_TYPE(
'streamWritable',
'stream.Writable',
Expand Down

0 comments on commit f73e049

Please sign in to comment.