BrainMinder/assets/static/js/htmx/ext/method-override.js

12 lines
383 B
JavaScript
Raw Normal View History

2024-08-22 10:13:16 +02:00
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";
}
}
}
});