electron/spec/fixtures/pages/service-worker/service-worker.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
306 B
JavaScript
Raw Normal View History

2016-03-25 20:03:49 +00:00
self.addEventListener('fetch', function (event) {
const requestUrl = new URL(event.request.url);
if (requestUrl.pathname === '/echo' &&
2016-03-25 20:03:49 +00:00
event.request.headers.has('X-Mock-Response')) {
const mockResponse = new Response('Hello from serviceWorker!');
2016-03-25 20:03:49 +00:00
event.respondWith(mockResponse);
}
2016-03-25 20:03:49 +00:00
});