OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Response error</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#response"> |
| 7 <meta name="author" title="Canon Research France" href="https://www.crf.cano
n.fr"> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 </head> |
| 11 <body> |
| 12 <script> |
| 13 var invalidStatus = [0, 100, 199, 600, 1000]; |
| 14 invalidStatus.forEach(function(status) { |
| 15 test(function() { |
| 16 assert_throws(new RangeError() , function() { new Response("", { "stat
us" : status }); }, |
| 17 "Expect RangeError exception when status is " + status); |
| 18 },"Throws RangeError when responseInit's status is " + status); |
| 19 }); |
| 20 |
| 21 var invalidStatusText = ["\n", "Ā"]; |
| 22 invalidStatusText.forEach(function(statusText) { |
| 23 test(function() { |
| 24 assert_throws(new TypeError() , function() { new Response("", { "statu
sText" : statusText }); }, |
| 25 "Expect TypeError exception " + statusText); |
| 26 },"Throws TypeError when responseInit's statusText is " + statusText); |
| 27 }); |
| 28 |
| 29 var nullBodyStatus = [204, 205, 304]; |
| 30 nullBodyStatus.forEach(function(status) { |
| 31 test(function() { |
| 32 assert_throws(new TypeError() , |
| 33 function() { new Response("body", {"status" : status }); }, |
| 34 "Expect TypeError exception "); |
| 35 },"Throws TypeError when building a response with body and a body status
of " + status); |
| 36 }); |
| 37 </script> |
| 38 </body> |
| 39 </html> |
OLD | NEW |