mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #4308 from node-red/revert-3991-http-request-form-array
Revert "Support form-data arrays"
This commit is contained in:
commit
dbc7284b97
@ -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));
|
||||
}
|
||||
|
@ -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' ]
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user