Skip to content

Commit

Permalink
Merge pull request #4308 from node-red/revert-3991-http-request-form-…
Browse files Browse the repository at this point in the history
…array

Revert "Support form-data arrays"
  • Loading branch information
knolleary committed Sep 5, 2023
2 parents cc5533c + 46b15a5 commit dbc7284
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,6 @@ in your Node-RED user directory (${RED.settings.userDir}).
formData.append(opt, val);
} else if (typeof val === 'object' && val.hasOwnProperty('value')) {
formData.append(opt,val.value,val.options || {});
} else if (Array.isArray(val)) {
for (var i=0; i<val.length; i++) {
formData.append(opt, val[i])
}
} else {
formData.append(opt,JSON.stringify(val));
}
Expand Down
34 changes: 0 additions & 34 deletions test/nodes/core/network/21-httprequest_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2334,38 +2334,4 @@ describe('HTTP Request Node', function() {
});
}
});

describe('multipart form posts', function() {
it('should send arrays as multiple entries', function (done) {
const flow = [
{
id: 'n1', type: 'http request', wires: [['n2']], method: 'POST', ret: 'obj', url: getTestURL('/file-upload'), headers: [
]
},
{ id: "n2", type: "helper" }
];
helper.load(httpRequestNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on('input', function(msg){
try {
msg.payload.body.should.have.property('foo')
msg.payload.body.list.should.deepEqual(['a','b','c'])
done()
} catch (e) {
done(e)
}
});
n1.receive({
headers: {
'content-type': 'multipart/form-data'
},
payload: {
foo: 'bar',
list: [ 'a', 'b', 'c' ]
}
});
})
});
})
});

0 comments on commit dbc7284

Please sign in to comment.