OLD | NEW |
(Empty) | |
| 1 if (this.document === undefined) { |
| 2 importScripts("/resources/testharness.js"); |
| 3 importScripts("../resources/utils.js"); |
| 4 } |
| 5 |
| 6 function basicAuth(desc, user, pass, mode, status) { |
| 7 promise_test(function(test) { |
| 8 var headers = { "Authorization": "Basic " + btoa(user + ":" + pass)}; |
| 9 var requestInit = {"credentials": mode, "headers": headers}; |
| 10 return fetch(RESOURCES_DIR + "authentication.py?realm=test", requestInit).th
en(function(resp) { |
| 11 assert_equals(resp.status, status, "HTTP status is " + status); |
| 12 assert_equals(resp.type , "basic", "Response's type is basic"); |
| 13 }); |
| 14 }, desc); |
| 15 } |
| 16 |
| 17 basicAuth("User-added Authorization header with include mode", "user", "password
", "include", 200); |
| 18 basicAuth("User-added Authorization header with same-origin mode", "user", "pass
word", "same-origin", 200); |
| 19 basicAuth("User-added Authorization header with omit mode", "user", "password",
"omit", 200); |
| 20 |
| 21 done(); |
OLD | NEW |