BrainMinder/assets/static/js/htmx/ext/method-override.js
2024-08-22 10:13:16 +02:00

12 lines
383 B
JavaScript

htmx.defineExtension('method-override', {
onEvent: function (name, evt) {
if (name === "htmx:configRequest") {
var method = evt.detail.verb;
if (method !== "get" || method !== "post") {
evt.detail.headers['X-HTTP-Method-Override'] = method.toUpperCase();
evt.detail.verb = "post";
}
}
}
});