Re: [w3c/ServiceWorker] Allow Caching of POST requests (#977)

I'm running into this issue as well. I utilize third-party APIs for my PWA for our fundraising participant center app (see API doc is at http://open.convio.com/api/#teamraiser_api for examples), and although a handful of APIs allow for GET requests, most require POST (for simplicity, we handle everything in POST because of this fact). I'm guessing it's due to the size of the request, security, or a combo of the two that the provider mostly only supports POST. For our PWA (alz.org/walk, must be registered to log into the PWA), I am able to cache all the static responses so the app can load offline, but I can't access any of the pertinent data (fundraising amount, gifts, contacts, personal page content...) while offline because that data sits behind a POST request. If POST responses can't be cached from the service worker, then I'm guessing I have to handle this within the app - if online, translate the data from POST responses inside the app into a JSON object and then save that JSON object in IDB, and then when offline, have the service worker send a response to notify the app to pull from IDB rather than look to the response? Seems like a messy solution (caching some data via service worker, and other data via app), but I'm at a loss until the service worker can cache the POST responses. Am I missing something more obvious? It just seems that the idea that POST is only used for pushing data to the server isn't valid, as in my example and nolanlawson's Couch example.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/977#issuecomment-293318597

Received on Tuesday, 11 April 2017 16:28:07 UTC