response-stream-disturbed-5.any.js (677B)
1 // META: global=window,worker 2 // META: title=Consuming Response body after getting a ReadableStream 3 // META: script=./response-stream-disturbed-util.js 4 5 for (const bodySource of ["fetch", "stream", "string"]) { 6 for (const consumeAs of ["blob", "text", "json", "arrayBuffer"]) { 7 promise_test( 8 async () => { 9 const response = await responseFromBodySource(bodySource); 10 response[consumeAs](); 11 assert_not_equals(response.body, null); 12 assert_throws_js(TypeError, function () { 13 response.body.getReader(); 14 }); 15 }, 16 `Getting a body reader after consuming as ${consumeAs} (body source: ${bodySource})`, 17 ); 18 } 19 }