-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1504103 [wpt PR 13849] - Fetch: Access-Control-Expose-Headers par…
…sing, a=testonly Automatic update from web-platform-testsFetch: Access-Control-Expose-Headers parsing See whatwg/fetch#814 for context. -- wpt-commits: 645c0e8a5c028a613e7ad1732834100dbe946fc7 wpt-pr: 13849 UltraBlame original commit: b12ab8efbefe006789483f40036d4b1fe8eab05f
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
testing/web-platform/tests/cors/access-control-expose-headers-parsing.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
promise_test(() => fetch("resources/access-control-expose-headers.json").then(res => res.json()).then(runTests), "Loading JSON…"); | ||
|
||
function runTests(allTestData) { | ||
allTestData.forEach(testData => { | ||
const encodedInput = encodeURIComponent(testData.input); | ||
promise_test(() => { | ||
const relativeURL = "resources/expose-headers.py?expose=" + encodedInput, | ||
url = new URL(relativeURL, location.href).href.replace("://", "://élève."); | ||
return fetch(url).then(res => { | ||
assert_equals(res.headers.get("content-language"), "mkay"); | ||
assert_equals(res.headers.get("bb-8"), (testData.exposed ? "hey" : null)); | ||
}); | ||
}, "Parsing: " + encodedInput); | ||
}) | ||
} |
62 changes: 62 additions & 0 deletions
62
testing/web-platform/tests/cors/resources/access-control-expose-headers.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[ | ||
{ | ||
"input": "access-control-expose-headers: BB-8", | ||
"exposed": true | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8,,@#$#%%&^&^*()()11!", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8, no no", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: @#$#%%&^&^*()()11!,bb-8", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8\r\nAccess-Control-Expose-Headers: no", | ||
"exposed": true | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8\r\nAccess-Control-Expose-Headers: no no", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: no\r\nAccess-Control-Expose-Headers: bb-8", | ||
"exposed": true | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers:\r\nAccess-Control-Expose-Headers: bb-8", | ||
"exposed": true | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: ,bb-8", | ||
"exposed": true | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8\u000C", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8\u000B", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: bb-8\u000B,bb-8", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: 'bb-8'", | ||
"exposed": false | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: 'bb-8',bb-8", | ||
"exposed": true | ||
}, | ||
{ | ||
"input": "Access-Control-Expose-Headers: \"bb-8\",bb-8", | ||
"exposed": false | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
testing/web-platform/tests/cors/resources/expose-headers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def main(request, response): | ||
response.add_required_headers = False | ||
output = "HTTP/1.1 221 ALL YOUR BASE BELONG TO H1\r\n" | ||
output += "Access-Control-Allow-Origin: *\r\n" | ||
output += "BB-8: hey\r\n" | ||
output += "Content-Language: mkay\r\n" | ||
output += request.GET.first("expose") + "\r\n" | ||
output += "\r\n" | ||
response.writer.write(output) | ||
response.close_connection = True |