Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(url, log, defaults, lifecycle) {
this._log = log;
this._defaults = defaults;
this._wreck = Wreck.defaults({
headers: { 'kbn-xsrf': 'ftr/services/uiSettings' },
baseUrl: url,
json: true,
redirects: 3,
});
if (this._defaults) {
lifecycle.on('beforeTests', async () => {
await this.update(defaults);
});
}
}
function makeWreck() {
return Wreck.defaults({
agents: {
http: new Http.Agent({ keepAlive: true, maxFreeSockets: Infinity }),
https: new Https.Agent({ keepAlive: true, maxFreeSockets: Infinity }),
httpsAllowUnauthorized: new Https.Agent({
keepAlive: true,
maxFreeSockets: Infinity,
rejectUnauthorized: false
})
}
})
}
constructor(config) {
const configHttpOptions = Hoek.applyToDefaults(config.http || {}, {
baseUrl: config.auth.tokenHost,
});
const httpOptions = Hoek.applyToDefaults(defaultHttpOptions, configHttpOptions);
this.config = config;
this.client = Wreck.defaults(httpOptions);
}