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 and has effects |
| 9 // because the whitespaces remain in the middle of header values as we call |
| 10 // setRequestHeader multiple times. |
| 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 |
| 17 xhr.setRequestHeader('test1', 'a '); |
| 18 xhr.setRequestHeader('test1', 'b'); |
| 19 |
| 20 xhr.onload = t.step_func(function() { |
| 21 // This expectation must be updated once we update header value checks. |
| 22 assert_regexp_match(xhr.responseText, /HTTP_TEST1: a , b\r?\n/, |
| 23 'Whitespaces remains in the middle of the header value.'); |
| 24 t.done(); |
| 25 }); |
| 26 xhr.onerror = t.unreached_func('should not fail'); |
| 27 xhr.send(); |
| 28 }, 'multiple setRequestHeader() with leading/trailing whitespaces'); |
| 29 |
| 30 done(); |
| 31 </script> |
| 32 </body> |
OLD | NEW |