diff --git a/test/nodes/core/network/21-httprequest_spec.js b/test/nodes/core/network/21-httprequest_spec.js index 0348dcea1..7584c5a54 100644 --- a/test/nodes/core/network/21-httprequest_spec.js +++ b/test/nodes/core/network/21-httprequest_spec.js @@ -2322,7 +2322,7 @@ describe('HTTP Request Node', function() { var n2 = helper.getNode("n2"); n2.on('input', function(msg) { try{ - msg.payload.should.equal(`RequestError: Parse Error: Missing expected CR after header value : http://localhost:${port}/`) + msg.payload.should.startWith(`RequestError: Parse Error:`) done() } catch (err) { done(err) @@ -2334,4 +2334,38 @@ 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' ] + } + }); + }) + }); + }) });