Closed jibees closed 1 year ago
Thanks for bringing this to our attention @jibees!
As we discussed this on Discord, it only surfaced in combination with mrujs when submitting a form. mrujs added a Accept: application/vnd.cable-ready.json
header to the request which caused some issues because we recently changed the CableReady MIME-Type to text/vnd.cable-ready.json
in #260.
Luckily the CableCar plugin for mrujs allows the MIME-Type to be configured, like:
mrujs.start({
plugins: [
new CableCar(CableReady, { mimeType: "text/vnd.cable-ready.json" })
]
})
This seems to solve the issue. @jibees is going to open a pull request on mrujs to update the default MIME-Type for the CableCar plugin in: https://github.com/KonnorRogers/mrujs/blob/86ec3ddea227c5125b2aa946af8e27837d4dae36/plugins/src/cableCar.ts#L16
Heads-up @KonnorRogers!
I'm going to close this issue! Thank you!
After some research, it appears that the underlying issue was something related to Content-Type
.
Accept: application/vnd.cable-ready.json, */*
Actually, cable_ready
changed its default ContentType recently (reference: https://github.com/stimulusreflex/cable_ready/pull/260)
And the form was actually submitted/handled via mrujs integrated with CableCar which clearly precise that form with accept header "application/vnd.cable-ready.json, */*"
will be handled
Source: https://mrujs.com/how-tos/integrate-cablecar
So, it's not actually a cable_ready
issue. Closing here!
Thanks for the great debugging session @marcoroth ! That was very pleasant!
Just opened a PR on mrujs: https://github.com/KonnorRogers/mrujs/pull/209 !
Awesome, thank you @jibees!
This code is functional for
pre10
:Response is:
Unfortunately, when bumping to
rc2
, with the following code:(only changing deprecated
operations
: tocable_ready
) it does not redirect my app, probably because the response is actually empty.operations:
instead ofcable_ready:
I had a deprecated warning, but the response is still empty.seems ok and is equal to:
#<CableReady::CableCar:0x00007fe3be5ecf28 @enqueued_operations=[{"url"=>"/", "operation"=>"redirectTo"}], @identifier="CableCar", @previous_selector=nil>
(at least json seems fine)