summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/service-workers/service-worker/navigation-preload/resources/redirect-scope.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/wpt/tests/service-workers/service-worker/navigation-preload/resources/redirect-scope.py')
-rw-r--r--test/wpt/tests/service-workers/service-worker/navigation-preload/resources/redirect-scope.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/wpt/tests/service-workers/service-worker/navigation-preload/resources/redirect-scope.py b/test/wpt/tests/service-workers/service-worker/navigation-preload/resources/redirect-scope.py
new file mode 100644
index 0000000..84a97e5
--- /dev/null
+++ b/test/wpt/tests/service-workers/service-worker/navigation-preload/resources/redirect-scope.py
@@ -0,0 +1,38 @@
+def main(request, response):
+ if b"base" in request.GET:
+ return [(b"Content-Type", b"text/html")], b"OK"
+ type = request.GET.first(b"type")
+
+ if type == b"normal":
+ response.status = 302
+ response.headers.append(b"Location", b"redirect-redirected.html")
+ response.headers.append(b"Custom-Header", b"hello")
+ return b""
+
+ if type == b"no-location":
+ response.status = 302
+ response.headers.append(b"Content-Type", b"text/html")
+ response.headers.append(b"Custom-Header", b"hello")
+ return b""
+
+ if type == b"no-location-with-body":
+ response.status = 302
+ response.headers.append(b"Content-Type", b"text/html")
+ response.headers.append(b"Custom-Header", b"hello")
+ return b"<body>BODY</body>"
+
+ if type == b"redirect-to-scope":
+ response.status = 302
+ response.headers.append(b"Location",
+ b"redirect-scope.py?type=redirect-to-scope2")
+ return b""
+ if type == b"redirect-to-scope2":
+ response.status = 302
+ response.headers.append(b"Location",
+ b"redirect-scope.py?type=redirect-to-scope3")
+ return b""
+ if type == b"redirect-to-scope3":
+ response.status = 302
+ response.headers.append(b"Location", b"redirect-redirected.html")
+ response.headers.append(b"Custom-Header", b"hello")
+ return b""