- From: James Dalessio <notifications@github.com>
- Date: Sun, 14 Aug 2016 14:00:12 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/836/239696566@github.com>
Sorry to necrobump guys: @jakearchibald I agree that middleware is the right path for anyone thinking about multiple "respondWith"s, but that sidetracked this issue. A real problem right now is that ```fetch(event.request)``` is not the same as simply not capturing the request, thanks to issues with range support and other outstanding issues with fetch. @wanderview Afaik resolving a promise passed to respondWith to `undefined` or `null` is not part of the spec unless I'm mistaken, unless you mean passing null or undefined to respondWith directly. That seems like a simple solution to the problem, and actually the first thing I tried. I believe it currently has to be a response object or network error. ```javascript self.addEventListener('fetch', event => { event.respondWith(async function () { const howToRespond = await howDoIRespond(); if (howToRespond === 'fromCache') { return await getFromCache(event.request); } else if (howToRespond === 'fetch') { return await fetch(event.request); } else if (howToRespond === 'passthough') { // Oh no. I already called event.respondWith. // How do I cancel and let the browser do its normal thing? } }); }); ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/836#issuecomment-239696566
Received on Sunday, 14 August 2016 21:00:39 UTC