blob: 604deece2d252d68b4f156403b6041b0290d5a9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Service worker for the xhr-content-length test.
self.addEventListener("fetch", event => {
const url = new URL(event.request.url);
const type = url.searchParams.get("type");
if (type === "no-content-length") {
event.respondWith(new Response("Hello!"));
}
if (type === "larger-content-length") {
event.respondWith(new Response("meeeeh", { headers: [["Content-Length", "10000"]] }));
}
if (type === "double-content-length") {
event.respondWith(new Response("meeeeh", { headers: [["Content-Length", "10000"], ["Content-Length", "10000"]] }));
}
if (type === "bogus-content-length") {
event.respondWith(new Response("meeeeh", { headers: [["Content-Length", "test"]] }));
}
});
|