How to use the @hint/utils-connector-tools/dist/src/requester.Requester function in @hint/utils-connector-tools

To help you get started, we’ve selected a few @hint/utils-connector-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webhintio / hint / packages / utils-debugging-protocol-common / src / debugging-protocol-connector.ts View on Github external
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;
    }