OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="/resources/testharness.js"></script> |
| 3 <script src="/resources/testharnessreport.js"></script> |
| 4 <script> |
| 5 async_test(test => { |
| 6 const xhr = new XMLHttpRequest(); |
| 7 xhr.onload = test.step_func(() => { |
| 8 const lines = xhr.responseText.split('\n'); |
| 9 for (let line of lines) { |
| 10 if (line.length == 0) { |
| 11 continue; |
| 12 } |
| 13 const parts = line.trim().split(': ', 2); |
| 14 if (parts.length < 2) { |
| 15 assert_unreached('Invalid line in response: ' + line); |
| 16 } |
| 17 if (parts[0] == 'HTTP_USER_AGENT') { |
| 18 assert_equals(parts[1], 'foobar'); |
| 19 test.done(); |
| 20 return; |
| 21 } |
| 22 } |
| 23 assert_unreached('User-Agent header not found'); |
| 24 test.done(); |
| 25 }); |
| 26 xhr.open('GET', 'resources/print-headers.cgi'); |
| 27 xhr.setRequestHeader('User-Agent', 'foobar'); |
| 28 xhr.send(); |
| 29 }, 'XMLHttpRequest.setRequestHeader() should accept User-Agent'); |
| 30 </script> |
OLD | NEW |