Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/resources/inspect-headers.py

Issue 2778753002: Import //fetch from Web Platform Tests. (Closed)
Patch Set: Baselines. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/fetch/api/resources/inspect-headers.py
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/resources/inspect-headers.py b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/resources/inspect-headers.py
new file mode 100644
index 0000000000000000000000000000000000000000..c4ace18ab64b11e9c09054c08be2d4d22f70264e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/resources/inspect-headers.py
@@ -0,0 +1,22 @@
+def main(request, response):
+ headers = []
+ request_headers = []
+ if "headers" in request.GET:
+ checked_headers = request.GET.first("headers").split("|")
+ for header in checked_headers:
+ if header in request.headers:
+ headers.append(("x-request-" + header, request.headers.get(header, "") ))
+
+ if "cors" in request.GET:
+ if "Origin" in request.headers:
+ headers.append(("Access-Control-Allow-Origin", request.headers.get("Origin", "")))
+ else:
+ headers.append(("Access-Control-Allow-Origin", "*"))
+ headers.append(("Access-Control-Allow-Credentials", "true"))
+ headers.append(("Access-Control-Allow-Methods", "GET, POST, HEAD"))
+ exposed_headers = ["x-request-" + header for header in checked_headers]
+ headers.append(("Access-Control-Expose-Headers", ", ".join(exposed_headers)))
+ headers.append(("Access-Control-Allow-Headers", ", ".join(request.headers)))
+
+ headers.append(("content-type", "text/plain"))
+ return headers, ""

Powered by Google App Engine
This is Rietveld 408576698