Switching from axios to node-fetch as per review.

This commit is contained in:
mike12345567 2020-10-27 14:16:57 +00:00
parent 87175e70cf
commit 3d77163773
2 changed files with 4 additions and 6 deletions

View File

@ -47,7 +47,6 @@
"@sendgrid/mail": "^7.1.1",
"@sentry/node": "^5.19.2",
"aws-sdk": "^2.767.0",
"axios": "^0.21.0",
"bcryptjs": "^2.4.3",
"chmodr": "^1.2.0",
"csvtojson": "^2.0.10",

View File

@ -1,4 +1,4 @@
const axios = require("axios")
const fetch = require("node-fetch")
const RequestType = {
POST: "POST",
@ -71,20 +71,19 @@ module.exports.run = async function({ inputs }) {
}
const request = {
method: requestMethod,
url,
}
if (
requestBody &&
requestBody.length !== 0 &&
BODY_REQUESTS.indexOf(requestMethod) !== -1
) {
request.data = JSON.parse(requestBody)
request.body = JSON.parse(requestBody)
}
try {
const response = await axios(request)
const response = await fetch(url, request)
return {
response: response.data,
response: await response.json(),
success: response.status === 200,
}
} catch (err) {