From e4e3e0be7b420e0b389b0690dbbf085e140f85e7 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 9 Oct 2024 21:30:28 +0100 Subject: [PATCH] Add pfx tls test for tls config node --- .../nodes/core/network/21-httprequest_spec.js | 35 ++++++++++++++++-- test/resources/ssl/test.pfx | Bin 0 -> 2579 bytes 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 test/resources/ssl/test.pfx diff --git a/test/nodes/core/network/21-httprequest_spec.js b/test/nodes/core/network/21-httprequest_spec.js index 0df73b970..703fa1576 100644 --- a/test/nodes/core/network/21-httprequest_spec.js +++ b/test/nodes/core/network/21-httprequest_spec.js @@ -211,7 +211,7 @@ describe('HTTP Request Node', function() { } else { hash = crypto.createHash('md5'); } - + var hex = hash.update(value).digest('hex'); if (algorithm === 'SHA-512-256') { hex = hex.slice(0, 64); @@ -1802,10 +1802,37 @@ describe('HTTP Request Node', function() { }) }); + it('should use pfx tls file', function(done) { + var flow = [ + {id:"n1",type:"http request",wires:[["n2"]],method:"GET",ret:"txt",url:getSslTestURLWithoutProtocol('/text'),tls:"n3"}, + {id:"n2", type:"helper"}, + {id:"n3", type:"tls-config", p12:"test/resources/ssl/test.pfx", verifyservercert:false}]; + var testNodes = [httpRequestNode, tlsNode]; + helper.load(testNodes, flow, function() { + var n3 = helper.getNode("n3"); + var n2 = helper.getNode("n2"); + var n1 = helper.getNode("n1"); + n2.on("input", function(msg) { + try { + msg.should.have.property('payload','hello'); + msg.should.have.property('statusCode',200); + msg.should.have.property('headers'); + msg.headers.should.have.property('content-length',''+('hello'.length)); + msg.headers.should.have.property('content-type').which.startWith('text/html'); + msg.should.have.property('responseUrl').which.startWith('https://'); + done(); + } catch(err) { + done(err); + } + }); + n1.receive({payload:"foo"}); + }); + }); + it('should use env var http_proxy', function(done) { const url = getTestURL('/postInspect') const proxyUrl = "http://localhost:" + testProxyPort - + const flow = [ { id: "n1", type: "http request", wires: [["n2"]], method: "POST", ret: "obj", url: url }, { id: "n2", type: "helper" }, @@ -1830,7 +1857,7 @@ describe('HTTP Request Node', function() { it('should use env var https_proxy', function(done) { const url = getSslTestURL('/postInspect') const proxyUrl = "http://localhost:" + testProxyPort - + const flow = [ { id: "n1", type: "http request", wires: [["n2"]], method: "POST", ret: "obj", url: url }, { id: "n2", type: "helper" }, @@ -1855,7 +1882,7 @@ describe('HTTP Request Node', function() { it('should not use env var http*_proxy when no_proxy is set', function(done) { const url = getSslTestURL('/postInspect') const proxyUrl = "http://localhost:" + testProxyPort - + const flow = [ { id: "n1", type: "http request", wires: [["n2"]], method: "POST", ret: "obj", url: url }, { id: "n2", type: "helper" }, diff --git a/test/resources/ssl/test.pfx b/test/resources/ssl/test.pfx new file mode 100644 index 0000000000000000000000000000000000000000..519d8a3fc8ca753a4de4d85697a8efb939a59471 GIT binary patch literal 2579 zcmai$X*d)L7st(*nP%+UEktA~Ll{fQolJxfGA8@3$%IIRvKvd;cY|!%m8|6=j4;U3 zh%8|Y5zSix8$k;3Al74a0tjF_ZcP6s0EENu0nCmtMJW6`vLPfuTshgwbBV&1 z`Te6>d_2pdoQ83&>b1d{Cq?>%;Kz&P3%mgTF zHPg_=rRwfHpUp$Je#M1Su~3Epp&BAGh5}z1%q)veanmnIX)OFOL#LLR7a6+E8R8lGmlm@~1y%k?0DQNWtu;m$r4X>L$Y_ zwo5+5#cP&dm zwHvJb$gI#nLoeB$$Jh;*0-D+7Kxm6^wWxblIVmz2MlaWJ_uCgO67Sm1e3r3MT9+#Q z+UXA3gDN64Qcuk`?6p{`XUFtF)2SVnwCTjg`f-DPUFW zr(FU0L6Z4mmdtkGb?&UuCBpcD9LmaeD0f8eo?SKMtz*&-?3Zj_nf=km^MX!@zsJEF z16ln)&-ZLDl!91fZlx8J>xG}0RpPKSHZ-?45+M5%8tKeg!Q+}orEB&|cMX5QTSZIo z8^d;w13IXG;It-`$=^`EatF<#gnA>Rh&qDLCSKwV&5IOAaS{i2LW=8hR0bb?$-Rz! zPkOL1e}@d1Qx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