Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
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);
}