service-worker-mock
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -10,3 +10,4 @@ // https://developer.mozilla.org/en-US/docs/Web/API/Cache | ||
if (this.store.has(url)) { | ||
return Promise.resolve(this.store.get(url)); | ||
const value = this.store.get(url); | ||
return Promise.resolve(value.response); | ||
} | ||
@@ -19,3 +20,4 @@ return Promise.resolve(null); | ||
if (this.store.has(url)) { | ||
return Promise.resolve([this.store.get(url)]); | ||
const value = this.store.get(url); | ||
return Promise.resolve([value.response]); | ||
} | ||
@@ -38,4 +40,7 @@ return Promise.resolve(null); | ||
put(request, response) { | ||
const url = request.url || request; | ||
this.store.set(url, response); | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
this.store.set(request.url, { request, response }); | ||
return Promise.resolve(); | ||
@@ -50,3 +55,4 @@ } | ||
keys() { | ||
return Promise.resolve(Array.from(this.store.keys())); | ||
const values = Array.from(this.store.values()); | ||
return Promise.resolve(values.map((value) => value.request)); | ||
} | ||
@@ -62,3 +68,3 @@ | ||
} | ||
snapshot[key] = entry[1]; | ||
snapshot[key] = entry[1].response; | ||
} | ||
@@ -65,0 +71,0 @@ return snapshot; |
{ | ||
"name": "service-worker-mock", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16151
416