OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <head> |
| 3 <script src = "../../resources/testharness.js"></script> |
| 4 <script src = "../../resources/testharnessreport.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 // Normalization will remove leading/trailing whitespaces, but has no |
| 9 // effect because the whitespaces are already stripped before the request |
| 10 // is sent to the network. |
| 11 // https://fetch.spec.whatwg.org/#concept-header-value-normalize |
| 12 // https://crbug.com/455099 |
| 13 async_test(function(t) { |
| 14 var xhr = new XMLHttpRequest; |
| 15 xhr.open("GET", "../resources/print-headers.cgi"); |
| 16 console.error('This error is added to avoid presubmit errors for -expected.txt
with no CONSOLE WARNING. This is testing that no CONSOLE WARNING is shown for s
etRequestHeader().'); |
| 17 |
| 18 xhr.setRequestHeader('test1', ' a '); |
| 19 xhr.setRequestHeader('test2', '\ta\t'); |
| 20 |
| 21 xhr.onload = t.step_func(function() { |
| 22 assert_regexp_match(xhr.responseText, /HTTP_TEST1: a\r?\n/, |
| 23 'Leading/trailing whitespaces (0x20) are already stripped.'); |
| 24 assert_regexp_match(xhr.responseText, /HTTP_TEST2: a\r?\n/, |
| 25 'Leading/trailing whitespaces (0x09) are already stripped.'); |
| 26 t.done(); |
| 27 }); |
| 28 xhr.onerror = t.unreached_func('should not fail'); |
| 29 xhr.send(); |
| 30 }, 'single setRequestHeader() with leading/trailing whitespaces'); |
| 31 |
| 32 done(); |
| 33 </script> |
| 34 </body> |
OLD | NEW |