From 5ee6138a36c88bbffbf61004a3b8845db7099116 Mon Sep 17 00:00:00 2001 From: MaxGenash Date: Fri, 4 Dec 2020 17:58:58 +0200 Subject: [PATCH] fix: (strf-8840) add missing rejectUnauthorized parameter to the API requests --- lib/utils/networkUtils.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/utils/networkUtils.js b/lib/utils/networkUtils.js index 66e1d17c..b1f3ab1a 100644 --- a/lib/utils/networkUtils.js +++ b/lib/utils/networkUtils.js @@ -2,16 +2,21 @@ * @module Contains helpers functions for working with network requests */ -const fetch = require('node-fetch'); +const https = require('https'); const fs = require('fs'); const axios = require('axios'); -/** +/** Used to send request to our (Bigcommerce) servers only. + * Shouldn't be used to send requests to third party servers because we disable https checks + * * @param {object} options * @returns {Promise} */ async function sendApiRequest(options) { - return axios(options); + return axios({ + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + ...options, + }); } /**