UNPKG

383 BJavaScriptView Raw
1htmx.defineExtension('method-override', {
2 onEvent: function (name, evt) {
3 if (name === "htmx:configRequest") {
4 var method = evt.detail.verb;
5 if (method !== "get" || method !== "post") {
6 evt.detail.headers['X-HTTP-Method-Override'] = method.toUpperCase();
7 evt.detail.verb = "post";
8 }
9 }
10 }
11});