summaryrefslogtreecommitdiffstats
path: root/netwerk/test/browser/early_hint_redirect.sjs
diff options
context:
space:
mode:
Diffstat (limited to 'netwerk/test/browser/early_hint_redirect.sjs')
-rw-r--r--netwerk/test/browser/early_hint_redirect.sjs21
1 files changed, 21 insertions, 0 deletions
diff --git a/netwerk/test/browser/early_hint_redirect.sjs b/netwerk/test/browser/early_hint_redirect.sjs
new file mode 100644
index 0000000000..6bcb6bdc86
--- /dev/null
+++ b/netwerk/test/browser/early_hint_redirect.sjs
@@ -0,0 +1,21 @@
+"use strict";
+
+function handleRequest(request, response) {
+ // increase count
+ let count = JSON.parse(getSharedState("earlyHintCount"));
+ if (
+ request.hasHeader("X-Moz") &&
+ request.getHeader("X-Moz") === "early hint"
+ ) {
+ count.hinted += 1;
+ } else {
+ count.normal += 1;
+ }
+ setSharedState("earlyHintCount", JSON.stringify(count));
+
+ // respond with redirect
+ response.setStatusLine(request.httpVersion, 301, "Moved Permanently");
+ let location = request.queryString;
+ response.setHeader("Location", location, false);
+ response.write("Hello world!");
+}