rubyforgood / coral

An upcoming project for Ruby for Good
MIT License
13 stars 11 forks source link

include request method, headers, and body in indexeddb #79

Closed bjmllr closed 4 years ago

bjmllr commented 4 years ago

Description

In order to replay a deferred request to add a record to the database, we need at least the url and method (to dispatch to the correct controller action), the headers (to satisfy authentication requirements), and the body. Before this change we only stored the url in indexeddb, and after this change we will also store the method, headers, and body.

A more general example can be seen at https://serviceworke.rs/request-deferrer_service-worker_doc.html (function serialize).

Type of change

How Has This Been Tested?

LizPrescott commented 4 years ago

Thank you for doing this! This is so exciting. I was able to confirm that a body is getting written in safari as well. I was not able to confirm that the body included the form data I had just entered. It gets cut off in the middle of the authenticity token. Were you able to see more than that? Either way, this feels like a breakthrough. Would love @bhaibel to take a look.

bjmllr commented 4 years ago

@LizPrescott the IndexedDB views in the debuggers don't seem to accommodate large blob values very well, but I was able to see the full body in Firefox by copying the value and pasting it somewhere else, and in Chrome by hovering the mouse pointer over the truncated body value.

LizPrescott commented 4 years ago

Thanks for your patience. I see it now! This is extremely cool! LGTM!