blob: 850874b8116dabc2a86de9c183ca430b2a415f06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
self.addEventListener('fetch', function(event) {
var url = event.request.url;
if (url.indexOf('sample?test') == -1) {
return;
}
event.respondWith(new Promise(function(resolve) {
var headers = new Headers;
headers.append('foo', 'foo');
headers.append('foo', 'b\0r'); // header value with a null byte
resolve(new Response('hello world', {'headers': headers}));
}));
});
|