More checks before returning

This commit is contained in:
RMidhunSuresh 2021-11-08 15:11:41 +05:30
parent d31371b486
commit d1491cc203

View file

@ -68,8 +68,10 @@ async function purgeOldCaches() {
}
}
self.addEventListener('fetch', (event) => {
if (event.request.url.indexOf("upload") !== -1) {
self.addEventListener('fetch', async (event) => {
if (event.request.method === "POST" &&
(await event.request.blob()).type !== "application/json" &&
event.request.body) {
return;
}
event.respondWith(handleRequest(event.request));