I’m currently replacing turbolinks with turbo and I need to modify the headers of a request, some are dependent on the URL the request is for, however I’m having difficultly doing that as I don’t have the URL in the event.
Also I tried caching the URL from turbo:before-visit
event but for form submissions the order is different:
# clicking a URL the event sequence is:
turbo:before-visit
turbo:before-fetch-request
turbo:before-fetch-response
turbo:before-cache
turbo:before-render
turbo:render
turbo:load
# submitting a form it is
turbo:before-fetch-request
turbo:submit-start
turbo:before-fetch-response
turbo:submit-end
turbo:before-visit
turbo:before-cache
turbo:before-render
turbo:render
turbo:load
I don’t even have ability to get the form being submitted as the event targets are the document/HTML node.