mirror of
https://github.com/servo/servo.git
synced 2025-08-13 17:35:36 +01:00
Update web-platform-tests to revision b'9be67046d1f0d57d0d4fba089f151ef044572f5d'
This commit is contained in:
parent
55c6d24dca
commit
831ab387a5
124 changed files with 3104 additions and 542 deletions
|
@ -0,0 +1,26 @@
|
|||
// META: global=window,worker
|
||||
// META: script=/common/get-host-info.sub.js
|
||||
|
||||
const authorizationValue = "Basic " + btoa("user:pass");
|
||||
async function getAuthorizationHeaderValue(url)
|
||||
{
|
||||
const headers = { "Authorization": authorizationValue};
|
||||
const requestInit = {"headers": headers};
|
||||
const response = await fetch(url, requestInit);
|
||||
return response.text();
|
||||
}
|
||||
|
||||
promise_test(async test => {
|
||||
const result = await getAuthorizationHeaderValue("/fetch/api/resources/dump-authorization-header.py");
|
||||
assert_equals(result, authorizationValue);
|
||||
}, "getAuthorizationHeaderValue - no redirection");
|
||||
|
||||
promise_test(async test => {
|
||||
const result = await getAuthorizationHeaderValue("/fetch/api/resources/redirect.py?location=" + encodeURIComponent("/fetch/api/resources/dump-authorization-header.py"));
|
||||
assert_equals(result, authorizationValue);
|
||||
}, "getAuthorizationHeaderValue - same origin redirection");
|
||||
|
||||
promise_test(async (test) => {
|
||||
const result = await getAuthorizationHeaderValue(get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/api/resources/redirect.py?allow_headers=Authorization&location=" + encodeURIComponent(get_host_info().HTTP_ORIGIN + "/fetch/api/resources/dump-authorization-header.py"));
|
||||
assert_equals(result, "none");
|
||||
}, "getAuthorizationHeaderValue - cross origin redirection");
|
|
@ -0,0 +1,14 @@
|
|||
def main(request, response):
|
||||
headers = [(b"Content-Type", "text/html"),
|
||||
(b"Cache-Control", b"no-cache")]
|
||||
|
||||
if b"Origin" in request.headers:
|
||||
headers.append((b"Access-Control-Allow-Origin", request.headers.get(b"Origin", b"")))
|
||||
headers.append((b"Access-Control-Allow-Credentials", b"true"))
|
||||
else:
|
||||
headers.append((b"Access-Control-Allow-Origin", b"*"))
|
||||
headers.append((b"Access-Control-Allow-Headers", b'Authorization'))
|
||||
|
||||
if b"authorization" in request.headers:
|
||||
return 200, headers, request.headers.get(b"Authorization")
|
||||
return 200, headers, "none"
|
Loading…
Add table
Add a link
Reference in a new issue