Add htmx 'json-enc' extension as a vendored JS file

This commit is contained in:
Alessio 2023-12-31 15:44:13 -06:00
parent 52172e4e81
commit 474b30cdc1

View File

@ -0,0 +1,12 @@
htmx.defineExtension('json-enc', {
onEvent: function (name, evt) {
if (name === "htmx:configRequest") {
evt.detail.headers['Content-Type'] = "application/json";
}
},
encodeParameters : function(xhr, parameters, elt) {
xhr.overrideMimeType('text/json');
return (JSON.stringify(parameters));
}
});