OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Headers normalize values</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#concept-header-value-
normalize"> |
| 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 headerDictWS = {"name1": " space ", |
| 14 "name2": "\ttab\t", |
| 15 "name3": " spaceAndTab\t", |
| 16 "name4": "\r\n newLine", //obs-fold cases |
| 17 "name5": "newLine\r\n ", |
| 18 "name6": "\r\n\tnewLine", |
| 19 }; |
| 20 |
| 21 test(function() { |
| 22 var headers = new Headers(headerDictWS); |
| 23 for (name in headerDictWS) |
| 24 assert_equals(headers.get(name), headerDictWS[name].trim(), |
| 25 "name: " + name + " has normalized value: " + headerDictWS[name].tri
m()); |
| 26 }, "Create headers with not normalized values"); |
| 27 |
| 28 test(function() { |
| 29 var headers = new Headers(); |
| 30 for (name in headerDictWS) { |
| 31 headers.append(name, headerDictWS[name]); |
| 32 assert_equals(headers.get(name), headerDictWS[name].trim(), |
| 33 "name: " + name + " has value: " + headerDictWS[name].trim()); |
| 34 } |
| 35 }, "Check append method with not normalized values"); |
| 36 |
| 37 test(function() { |
| 38 var headers = new Headers(); |
| 39 for (name in headerDictWS) { |
| 40 headers.set(name, headerDictWS[name]); |
| 41 assert_equals(headers.get(name), headerDictWS[name].trim(), |
| 42 "name: " + name + " has value: " + headerDictWS[name].trim()); |
| 43 } |
| 44 }, "Check set method with not normalized values"); |
| 45 </script> |
| 46 </body> |
| 47 </html> |
OLD | NEW |