How to use the @hint/utils-string.toLowerCaseKeys function in @hint/utils-string

To help you get started, we’ve selected a few @hint/utils-string 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-connector-tools / src / requester.ts View on Github external
public constructor(customOptions?: request.CoreOptions) {
        if (customOptions) {
            customOptions.followRedirect = false;
            customOptions.rejectUnauthorized = false;
            this._maxRedirects = customOptions.maxRedirects || this._maxRedirects;

            if (customOptions.headers) {
                /*
                 * We lower case everything because someone could use 'ACCEPT-Encoding' and then we will have 2 different keys.
                 * `request` probably normalizes this already but this way it's explicit and we know the user's headers will
                 * always take precedence.
                 */
                customOptions.headers = {
                    ...toLowerCaseKeys(defaults.headers),
                    ...toLowerCaseKeys(customOptions.headers)
                };
            }
        }

        const options: request.CoreOptions = {
            ...defaults,
            ...customOptions
        };

        this._options = options;

        this._request = request.defaults(options);
    }
github webhintio / hint / packages / utils-connector-tools / src / requester.ts View on Github external
public constructor(customOptions?: request.CoreOptions) {
        if (customOptions) {
            customOptions.followRedirect = false;
            customOptions.rejectUnauthorized = false;
            this._maxRedirects = customOptions.maxRedirects || this._maxRedirects;

            if (customOptions.headers) {
                /*
                 * We lower case everything because someone could use 'ACCEPT-Encoding' and then we will have 2 different keys.
                 * `request` probably normalizes this already but this way it's explicit and we know the user's headers will
                 * always take precedence.
                 */
                customOptions.headers = {
                    ...toLowerCaseKeys(defaults.headers),
                    ...toLowerCaseKeys(customOptions.headers)
                };
            }
        }

        const options: request.CoreOptions = {
            ...defaults,
            ...customOptions
        };

        this._options = options;

        this._request = request.defaults(options);
    }