@chg20 Last thing I was stumbling upon: When I tried to access the gist github api in my example directly, the call got rejected with the message that their CORS rules don't allow X-HX-Current-url
Header, so I tried to reset them:
document.body.addEventListener('configRequest.htmx', function(evt) {
// try to remove x-hx-* headers because gist api compalins about CORS
evt.detail.headers = [];
});
but the current-url header is sent anyway.
Would it be possible to have full control over that?
Object.keys(evt.details.headers).forEach(function(key) { delete object[key]; });
<body script="on configRequest.htmx put [] into detail.headers">
...
</body>
X-HX-Request
header, but I'd like to avoid having to do that on every single request
htmx.defineExtension('rails-method', {
onEvent: function (name, evt) {
if (name === "configRequest.htmx") {
var methodOverride = evt.detail.headers['X-HTTP-Method-Override'];
if (methodOverride) {
evt.detail.parameters['_method'] = methodOverride;
}
}
}
});
htmx.defineExtension('larvel-support', {
onEvent: function (name, evt) {
if (name === "configRequest.htmx") {
evt.detail.headers['X-Requested-With'] = "ajax";
}
}
});
<body hx-ext="larvel-support>
...
</body>