Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: fix the ReadableStreamBYOBReader error message #40846

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ class ReadableStream {
return customInspect(depth, options, this[kType], {
locked: this.locked,
state: this[kState].state,
supportsBYOB:
this[kState].controller instanceof ReadableByteStreamController,
});
}

Expand Down Expand Up @@ -1745,7 +1747,7 @@ function setupReadableStreamBYOBReader(reader, stream) {
controller,
} = stream[kState];
if (!isReadableByteStreamController(controller))
throw new ERR_INVALID_ARG_VALUE('reader', reader, 'must be a byte stream');
throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be a byte stream');
readableStreamReaderGenericInitialize(reader, stream);
reader[kState].readIntoRequests = [];
}
Expand Down
6 changes: 4 additions & 2 deletions test/parallel/test-whatwg-readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1410,10 +1410,12 @@ class Source {

assert.strictEqual(
inspect(readable),
'ReadableStream { locked: false, state: \'readable\' }');
'ReadableStream { locked: false, state: \'readable\', ' +
'supportsBYOB: false }');
assert.strictEqual(
inspect(readable, { depth: null }),
'ReadableStream { locked: false, state: \'readable\' }');
'ReadableStream { locked: false, state: \'readable\', ' +
'supportsBYOB: false }');
assert.strictEqual(
inspect(readable, { depth: 0 }),
'ReadableStream [Object]');
Expand Down