mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
don't set Content-Type in the presence of hx-encoding
This commit is contained in:
parent
b401f54c54
commit
6900ab8278
@ -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
|
||||
|
@ -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);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user