Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /fetch/api/response/response-stream-disturbed-by-pipe.any.html - WPT Dashboard Interop Dashboard
- /fetch/api/response/response-stream-disturbed-by-pipe.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /fetch/api/response/response-stream-disturbed-by-pipe.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /fetch/api/response/response-stream-disturbed-by-pipe.any.worker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker
test(() => {
const r = new Response(new ReadableStream());
// highWaterMark: 0 means that nothing will actually be read from the body.
r.body.pipeTo(new WritableStream({}, {highWaterMark: 0}));
assert_true(r.bodyUsed, 'bodyUsed should be true');
}, 'using pipeTo on Response body should disturb it synchronously');
test(() => {
const r = new Response(new ReadableStream());
r.body.pipeThrough({
writable: new WritableStream({}, {highWaterMark: 0}),
readable: new ReadableStream()
});
assert_true(r.bodyUsed, 'bodyUsed should be true');
}, 'using pipeThrough on Response body should disturb it synchronously');