summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/links/downloading-resources/resources/inspect-header.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/links/downloading-resources/resources/inspect-header.py')
-rw-r--r--testing/web-platform/tests/html/semantics/links/downloading-resources/resources/inspect-header.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/links/downloading-resources/resources/inspect-header.py b/testing/web-platform/tests/html/semantics/links/downloading-resources/resources/inspect-header.py
new file mode 100644
index 0000000000..2c68e475ff
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/links/downloading-resources/resources/inspect-header.py
@@ -0,0 +1,18 @@
+def main(request, response):
+ headers = [(b"Content-Type", b"text/plain")]
+ command = request.GET.first(b"cmd").lower()
+ test_id = request.GET.first(b"id")
+ header = request.GET.first(b"header")
+ if command == b"put":
+ request.server.stash.put(test_id, request.headers.get(header, b""))
+
+ elif command == b"get":
+ stashed_header = request.server.stash.take(test_id)
+ if stashed_header is not None:
+ headers.append((b"x-request-" + header, stashed_header))
+
+ else:
+ response.set_error(400, u"Bad Command")
+ return b"ERROR: Bad Command!"
+
+ return headers, b""