blob: 712c4b73c9bc6da7c828a4c194b09ad9018d47ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
self.addEventListener('fetch', function(event) {
var testcase = new URL(event.request.url).search;
switch (testcase) {
case '?response-object':
event.respondWith(new Response('body'));
break;
case '?response-promise-object':
event.respondWith(Promise.resolve(new Response('body')));
break;
case '?other-value':
event.respondWith(new Object());
break;
}
});
|