OLD | NEW |
(Empty) | |
| 1 if (this.document === undefined) { |
| 2 importScripts("/resources/testharness.js"); |
| 3 importScripts("../resources/utils.js"); |
| 4 } |
| 5 |
| 6 promise_test(function() { |
| 7 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept").then(functio
n(response) { |
| 8 assert_equals(response.status, 200, "HTTP status is 200"); |
| 9 assert_equals(response.type , "basic", "Response's type is basic"); |
| 10 assert_equals(response.headers.get("x-request-accept"), "*/*", "Request has
accept header with value '*/*'"); |
| 11 }); |
| 12 }, "Request through fetch should have 'accept' header with value '*/*'"); |
| 13 |
| 14 promise_test(function() { |
| 15 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept", {"headers":
[["Accept", "custom/*"]]}).then(function(response) { |
| 16 assert_equals(response.status, 200, "HTTP status is 200"); |
| 17 assert_equals(response.type , "basic", "Response's type is basic"); |
| 18 assert_equals(response.headers.get("x-request-accept"), "custom/*", "Request
has accept header with value 'custom/*'"); |
| 19 }); |
| 20 }, "Request through fetch should have 'accept' header with value 'custom/*'"); |
| 21 |
| 22 promise_test(function() { |
| 23 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept-Language").the
n(function(response) { |
| 24 assert_equals(response.status, 200, "HTTP status is 200"); |
| 25 assert_equals(response.type , "basic", "Response's type is basic"); |
| 26 assert_true(response.headers.has("x-request-accept-language")); |
| 27 }); |
| 28 }, "Request through fetch should have a 'accept-language' header"); |
| 29 |
| 30 promise_test(function() { |
| 31 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept-Language", {"h
eaders": [["Accept-Language", "bzh"]]}).then(function(response) { |
| 32 assert_equals(response.status, 200, "HTTP status is 200"); |
| 33 assert_equals(response.type , "basic", "Response's type is basic"); |
| 34 assert_equals(response.headers.get("x-request-accept-language"), "bzh", "Req
uest has accept header with value 'bzh'"); |
| 35 }); |
| 36 }, "Request through fetch should have 'accept-language' header with value 'bzh'"
); |
| 37 |
| 38 done(); |
OLD | NEW |