Skip to content

Commit d0776e8

Browse files
chore: update WPT (nodejs#4067)
Co-authored-by: Uzlopak <[email protected]>
1 parent a180465 commit d0776e8

38 files changed

+463
-143
lines changed

test/fixtures/wpt/common/redirect.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ def main(request, response):
44
The request should typically have two query parameters:
55
status - The status to use for the redirection. Defaults to 302.
66
location - The resource to redirect to.
7+
8+
This utility optionally supports CORS (iff the `enable-cors` query param is
9+
present).
710
"""
811
status = 302
912
if b"status" in request.GET:
@@ -17,3 +20,10 @@ def main(request, response):
1720
location = request.GET.first(b"location")
1821

1922
response.headers.set(b"Location", location)
23+
24+
if request.GET.get(b"enable-cors") is not None:
25+
origin = request.headers.get(b"Origin")
26+
if origin:
27+
response.headers.set(b"Content-Type", b"text/plain")
28+
response.headers.set(b"Access-Control-Allow-Origin", origin)
29+
response.headers.set(b"Access-Control-Allow-Credentials", 'true')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// META: script=../../../service-workers/service-worker/resources/test-helpers.sub.js
2+
3+
promise_test(async t => {
4+
const frame = await with_iframe('./resources/hello.html.br');
5+
assert_equals(frame.contentDocument.body.textContent, 'Hello world');
6+
}, `Naigation to br encoded page`);
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Content-type: text/html
2+
Content-Encoding: br
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// META: script=../../../service-workers/service-worker/resources/test-helpers.sub.js
2+
3+
promise_test(async t => {
4+
const frame = await with_iframe('./resources/hello.html.gz');
5+
assert_equals(frame.contentDocument.body.textContent, 'Hello world');
6+
}, `Naigation to gzip encoded page`);
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Content-type: text/html
2+
Content-Encoding: gzip
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Content-type: text/html
2+
Content-Encoding: zstd
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// META: script=../../../service-workers/service-worker/resources/test-helpers.sub.js
2+
3+
promise_test(async t => {
4+
const frame = await with_iframe('./resources/hello.html.zst');
5+
assert_equals(frame.contentDocument.body.textContent, 'Hello world');
6+
}, `Naigation to zstd encoded page`);

0 commit comments

Comments
 (0)