From 0fb37de76d46d890f5257d571eff34b448e1e5da Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Mon, 13 Aug 2018 18:34:05 +0100 Subject: [PATCH 1/2] 3.3.1-snapshot hotfix Fix for the following issue: https://github.com/mojaloop/ml-api-adapter/issues/29 --- package.json | 2 +- src/handlers/notification/callbacks.js | 5 ++++- test/unit/handlers/notification/callbacks.test.js | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2ba4ab48..f5547929 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/ml-api-adapter", - "version": "3.3.0-snapshot", + "version": "3.3.1-snapshot", "description": "Convert from ML API to/from internal Central Services messaging format.", "license": "Apache-2.0", "private": true, diff --git a/src/handlers/notification/callbacks.js b/src/handlers/notification/callbacks.js index 4b1f8ea2..24fbb0f7 100644 --- a/src/handlers/notification/callbacks.js +++ b/src/handlers/notification/callbacks.js @@ -31,7 +31,10 @@ const sendCallback = async (url, method, headers, message) => { url, method, // headers, - body: JSON.stringify(message) + body: JSON.stringify(message), + agentOptions: { + rejectUnauthorized: false + } } return new Promise((resolve, reject) => { diff --git a/test/unit/handlers/notification/callbacks.test.js b/test/unit/handlers/notification/callbacks.test.js index 554d6920..fc6a4771 100644 --- a/test/unit/handlers/notification/callbacks.test.js +++ b/test/unit/handlers/notification/callbacks.test.js @@ -68,12 +68,15 @@ Test('Callback Service tests', callbacksTest => { const url = Config.DFSP_URLS['dfsp2'].transfers const method = 'post' const headers = {} + const agentOptions = { + rejectUnauthorized: false + } const expected = 200 const body = JSON.stringify(message) - request.withArgs({ url, method, body }).yields(null, { statusCode: 200 }, null) + request.withArgs({ url, method, body, agentOptions }).yields(null, { statusCode: 200 }, null) let result = await callback.sendCallback(url, method, headers, message) test.equal(result, expected) @@ -101,11 +104,14 @@ Test('Callback Service tests', callbacksTest => { const url = Config.DFSP_URLS['dfsp2'].transfers const method = 'post' const headers = {} + const agentOptions = { + rejectUnauthorized: false + } const body = JSON.stringify(message) const error = new Error() - request.withArgs({ url, method, body }).yields(error, null, null) + request.withArgs({ url, method, body, agentOptions }).yields(error, null, null) try { await callback.sendCallback(url, method, headers, message) From 93fa547feae019d2c2cf38c62766f96fe7069d64 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Mon, 13 Aug 2018 18:34:30 +0100 Subject: [PATCH 2/2] Updated sinon --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5547929..79ddde06 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "proxyquire": "1.7.10", "request": "^2.85.0", "rewire": "^4.0.1", - "sinon": "^5.0.10", + "sinon": "^6.1.5", "standard": "8.5.0", "supertest": "2.0.1", "tap-xunit": "1.4.0",