@esri/arcgis-rest-request: How to adjust Fetch options?

121
0
10-27-2021 12:27 PM
RYANCARL
New Contributor III

Hi all,

I am looking to adjust the Fetch request option when making a request with @esri/arcgis-rest-request, but unfortunately I cannot find any documentation related to this.

 

import fetch from "node-fetch";
import FormData from "isomorphic-form-data";
import arcgisRestRequest from "@esri/arcgis-rest-request";
arcgisRestRequest.setDefaultRequestOptions({ fetch, FormData });

arcgisRestRequest.request("https://www.arcgis.com/sharing/rest/info")
  .then(response => console.log(response));

 

 

When using the request method I am getting errors regarding the certificate of the NodeJS server:

 

FetchError: request to https://xxx/server/rest/self?token=xxx=json failed, reason: unable to get local issuer certificate

 


I would like to pass something like:

 

const fetchOptions = {
  ...
  agent:new https.Agent({rejectUnauthorized: false}),
  ...
};

 

to avoid the certificate error.

How can I accomplish this?

Tags (2)
0 Kudos
0 Replies