From 7fc0db32d1928179c6b4e4289f6fb0d5f8e0b14d Mon Sep 17 00:00:00 2001 From: Douglas Rafael Date: Thu, 23 Apr 2020 23:54:21 -0300 Subject: [PATCH] Adds config to requests made by axios. --- package.json | 4 ++-- policies/delete-user/delete-user.js | 5 ++++- services/http-client.js | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 941deac..6abaff3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "express-apigw-base-plugin", - "version": "1.3.0", + "version": "1.3.1", "description": "Express Gateway Base Plugin", "main": "manifest.js", "author": "NUTES/UEPB", @@ -20,7 +20,7 @@ "devDependencies": { "chai": "^4.2.0", "mocha": "^7.1.1", - "sinon": "^9.0.1", + "sinon": "^9.0.2", "supertest": "^4.0.2", "express-gateway": "^1.16.10" } diff --git a/policies/delete-user/delete-user.js b/policies/delete-user/delete-user.js index d266718..eb3801b 100644 --- a/policies/delete-user/delete-user.js +++ b/policies/delete-user/delete-user.js @@ -20,7 +20,10 @@ module.exports = function (actionParams, userServiceGwTest, axiosTest) { try { // 1. Delete user in account service. - const responseAccount = await userService.delete(`${actionParams.urlDeleteService}/${userId}`) + const responseAccount = await userService.delete( + `${actionParams.urlDeleteService}/${userId}`, + { headers: req.headers } + ) // 2. Find user at gateway and delete or skip if there is not. await deleteUserGateway(userId) diff --git a/services/http-client.js b/services/http-client.js index 29b0cbe..d01b7b3 100644 --- a/services/http-client.js +++ b/services/http-client.js @@ -11,11 +11,11 @@ const instance = axios.create({ }) module.exports = { - post: function (url, credentials) { - return instance.post(url, credentials) + post: function (url, body, config) { + return instance.post(url, body, config) }, - delete: function (url) { - return instance.delete(url) + delete: function (url, config) { + return instance.delete(url, config) } }