I'm trying to store CSRF protected (querystring + cookie) API POST requests for later replay when a webapp comes back online.
To do this, I want to save the Request Object (Fetch API) in IndexedDB, but IDBObjectStore.put fails with a DataCloneError "An object could not be cloned".
The Request object has a simple JSON body, no binary data, just all strings.
This is running in a service worker (a web worker) environment.
Is there any reason why the structured cloning algorithm would not clone a Request Object? [Answer: Yes] If so, what are my best options for dehydrating/rehydrating this object in lieu of structured cloning?
I really want to avoid having to know/access individual properties of the Request object. The parts of the Request I'll need are url, headers, body, and cookie (but again, I don't want the code to have to know about that).
Thanks in advance for any advice.