Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async fetchContent(target: URL | string, customHeaders?: object): Promise {
/*
* TODO: This should create a new tab, navigate to the
* resource and control what is received somehow via an event.
*/
const assigns = compact([this && this._headers, customHeaders]);
const headers = Object.assign({}, ...assigns);
const href: string = typeof target === 'string' ? target : target.href;
const options = {
headers,
// we sync the ignore SSL error options with `request`. This is neeeded for local https tests
rejectUnauthorized: !this._options.overrideInvalidCert,
strictSSL: !this._options.overrideInvalidCert
};
const request: Requester = new Requester(options);
const response: NetworkData = await request.get(href);
return response;
}