UNPKG

334 BJavaScriptView Raw
1htmx.defineExtension('rails-method', {
2 onEvent: function (name, evt) {
3 if (name === "configRequest.htmx") {
4 var methodOverride = evt.detail.headers['X-HTTP-Method-Override'];
5 if (methodOverride) {
6 evt.detail.parameters['_method'] = methodOverride;
7 }
8 }
9 }
10});