1
0
Fork 0
firefox/testing/web-platform/tests/speculation-rules/prefetch/resources/conditional-status.py
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

19 lines
520 B
Python

import json
import os.path
from wptserve.pipes import template
def main(request, response):
response.headers.set(b"Content-Type", b"text/html")
prefetch = request.headers.get("Sec-Purpose", b"").decode("utf-8").startswith("prefetch")
response.content = template(
request,
open(os.path.join(os.path.dirname(__file__), "executor.sub.html"), "rb").read())
if prefetch:
response.status = 503
response.content += b"<body>503"
else:
response.status = 200
response.content += b"<body>200"