diff --git a/src/htmx.js b/src/htmx.js index d07dd8d9..bcfe3cc1 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -1637,12 +1637,8 @@ return (function () { addExpressionVars(elt, rawParameters); var filteredParameters = filterValues(rawParameters, elt); - if (verb !== 'get') { - var encoding = getClosestAttributeValue(elt, "hx-encoding"); - if (encoding == null) { - encoding = 'application/x-www-form-urlencoded; charset=UTF-8'; - } - headers['Content-Type'] = encoding; + if (verb !== 'get' && getClosestAttributeValue(elt, "hx-encoding") == null) { + headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; } // behavior of anchors w/ empty href is to use the current URL diff --git a/test/core/ajax.js b/test/core/ajax.js index 87e20b43..69404d7f 100644 --- a/test/core/ajax.js +++ b/test/core/ajax.js @@ -630,8 +630,7 @@ describe("Core htmx AJAX Tests", function(){ it('multipart/form-data encoding works', function() { this.server.respondWith("POST", "/test", function(xhr){ - console.log(xhr); - xhr.requestHeaders['Content-Type'].startsWith("multipart/form-data"); + should.equal(xhr.requestHeaders['Content-Type'], undefined); xhr.requestBody.get("i1").should.equal('foo'); xhr.respond(200, {}, "body: " + xhr.requestBody); });