How to use the @hint/utils-connector-tools/dist/src/normalize-headers.normalizeHeaders 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
private async createResponse(cdpResponse: Crdp.Network.ResponseReceivedEvent, element: IAsyncHTMLElement): Promise {
        const resourceUrl: string = cdpResponse.response.url;
        const hops: Array = this._redirects.calculate(resourceUrl);
        const resourceHeaders: object = normalizeHeaders(cdpResponse.response.headers);
        let { content, rawContent, rawResponse } = await this.getResponseBody(cdpResponse);
        let retry = 3;

        /*
         * Sometimes, the content is empty at the beginning, but
         * after few millisecons, it isn't.
         */
        while (!content && (!rawContent || rawContent.length === 0) && retry > 0) {
            await delay(250);

            ({ content, rawContent, rawResponse } = await this.getResponseBody(cdpResponse));

            retry--;
        }

        if (retry === 0) {