UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Steps to reproduce the problem:
1. Get/create a ReadableStream>
/**
* Creates a ReadableStream that delivers a simple stream of data:
* <start><pull 1><pull 2>...<pull ${pullIters}>
*/
function newReadableStream(pullIters) {
const encoder = new TextEncoder();
let iter = 0;
return new ReadableStream({
start(controller) {
controller.enqueue(encoder.encode('<start>'));
},
pull(controller) {
if (iter < pullIters) {
controller.enqueue(encoder.encode(`<pull ${++iter}>`));
} else {
controller.close();
}
},
});
}
2. Confirm that it works with Response:
async test_direct() {
const stream = newReadableStream(3);
const response = new Response(stream);
const text = await response.text();
assertEquals('<start><pull 1><pull 2><pull 3>', text);
}
3. Create a class that wraps a ReadableStream:
class ReadableStreamWrapper {
constructor(stream) {
this.stream_ = stream;
}
get locked() {
return this.stream_.locked;
}
cancel(...args) {
return this.stream.cancel(...args);
}
getReader(...args) {
return this.stream.getReader(...args);
}
pipeThrough(...args) {
return this.stream.pipeThrough(...args);
}
pipeTo(...args) {
return this.stream.pipeTo(...args);
}
tee(...args) {
return this.stream.tee(...args);
}
}
4. Try the test again again with the wrapper:
async test_direct() {
const stream = new ReadableStreamWrapper(newReadableStream(3));
const response = new Response(stream);
const text = await response.text();
assertEquals('<start><pull 1><pull 2><pull 3>', text);
}
What is the expected behavior?
In step 4, I expect to get the text of the underlying ReadableStream.
What went wrong?
In step 4, response.text() resolves to "[object Object]" instead of correct text.
Did this work before? N/A
Chrome version: 63.0.3239.132 Channel: stable
OS Version: Linux 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linu
Flash Version:
Comment 1 by tkent@chromium.org
, Jan 12 2018