Skip to content

Instantly share code, notes, and snippets.

@wanderview
Created October 17, 2017 14:54
Show Gist options
  • Save wanderview/1c525a2a6a5b96f61357583933762627 to your computer and use it in GitHub Desktop.
Save wanderview/1c525a2a6a5b96f61357583933762627 to your computer and use it in GitHub Desktop.
SRI debugging service worker
self.skipWaiting();
addEventListener('fetch', evt => {
evt.respondWith(async function() {
try {
let response = await fetch(evt.request);
console.log(`==> SUCCESS for url:${evt.request.url} integity:${evt.request.integrity}`);
return response;
} catch(e) {
console.log(`==> FAILURE for url:${evt.request.url} integity:${evt.request.integrity}`);
}
}());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment