Use startsWith instead of a regular expression

This commit is contained in:
Mathias Bynens
2017-12-18 09:49:13 +01:00
committed by GitHub
parent 8687bf3fd8
commit e7f3411356

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)) {