summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/api/response/response-stream-disturbed-by-pipe.any.js
blob: 5341b75271ead59be5022afd99ffbe22a26628fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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');