Merge pull request #9 from mathiasbynens/patch-2

Use `startsWith` instead of a regular expression
This commit is contained in:
Rich Harris
2017-12-18 06:41:44 -05:00
committed by GitHub

View File

@@ -37,7 +37,7 @@ self.addEventListener('fetch', event => {
const url = new URL(event.request.url);
// don't try to handle e.g. data: URIs
if (!/^https?/.test(url.protocol)) return;
if (!url.protocol.startsWith('http')) return;
// always serve assets and webpack-generated files from cache
if (cached.has(url.pathname)) {