Answers for "node.js untrusted_authority: The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.""

0

node.js untrusted_authority: The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."

const fetch = require('node-fetch-with-proxy');

async function sendGetRequestAsync(url, options) {
  const response = await fetch(url, options);
  const json = await response.json();
  const headers = response.headers.raw();
  return {
    headers: Object.create(Object.prototype, headers),
    body: json,
    status: response.status
  }
}

async function sendPostRequestAsync(url, options) {
  const sendingOptions = options || {};
  sendingOptions.method = 'post';
  const response = await fetch(url, sendingOptions);
  const json = await response.json()
  const headers = response.headers.raw();
  return {
    headers: Object.create(Object.prototype, headers),
    body: json,
    status: response.status
  }

}

module.exports = {
  sendGetRequestAsync,
  sendPostRequestAsync
}
Posted by: Guest on June-08-2021

Code answers related to "node.js untrusted_authority: The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.""

Code answers related to "Javascript"

Browse Popular Code Answers by Language