OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Consuming Response body after getting a ReadableStream</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#response"> |
| 7 <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin"> |
| 8 <meta name="author" title="Canon Research France" href="https://www.crf.cano
n.fr"> |
| 9 <script src="/resources/testharness.js"></script> |
| 10 <script src="/resources/testharnessreport.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <script> |
| 14 |
| 15 promise_test(function() { |
| 16 return fetch("../resources/data.json").then(function(response) { |
| 17 response.blob(); |
| 18 assert_not_equals(response.body, null); |
| 19 assert_throws(new TypeError(), function() { response.body.getReader(); }
); |
| 20 }); |
| 21 }, "Getting a body reader after consuming as blob"); |
| 22 |
| 23 promise_test(function() { |
| 24 return fetch("../resources/data.json").then(function(response) { |
| 25 response.text(); |
| 26 assert_not_equals(response.body, null); |
| 27 assert_throws(new TypeError(), function() { response.body.getReader(); }
); |
| 28 }); |
| 29 }, "Getting a body reader after consuming as text"); |
| 30 |
| 31 promise_test(function() { |
| 32 return fetch("../resources/data.json").then(function(response) { |
| 33 response.json(); |
| 34 assert_not_equals(response.body, null); |
| 35 assert_throws(new TypeError(), function() { response.body.getReader(); }
); |
| 36 }); |
| 37 }, "Getting a body reader after consuming as json"); |
| 38 |
| 39 promise_test(function() { |
| 40 return fetch("../resources/data.json").then(function(response) { |
| 41 response.arrayBuffer(); |
| 42 assert_not_equals(response.body, null); |
| 43 assert_throws(new TypeError(), function() { response.body.getReader(); }
); |
| 44 }); |
| 45 }, "Getting a body reader after consuming as arrayBuffer"); |
| 46 |
| 47 </script> |
| 48 </body> |
| 49 </html> |
OLD | NEW |