Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (common_1.hasProperties(agentOptions) && url.startsWith('https:')) {
let existingAgents;
if (credentials.proxy)
existingAgents = proxyAgents.get(credentials.proxy);
else
existingAgents = agents;
if (existingAgents)
agent = agents.find(agent => {
return !Object.keys(agentOptions).some(opt => agent.options[opt] !== agentOptions[opt]);
});
if (!agent) {
if (credentials.proxy) {
if (!existingAgents)
proxyAgents.set(credentials.proxy, existingAgents = []);
existingAgents.push(agent = new https_proxy_agent_1.default(Object.assign({}, credentials.proxy)));
}
else {
agents.push(agent = (new https_1.Agent(agentOptions)));
}
}
}
this.debugLog(`${method} ${url}${writeCredentialLog(credentials)}`);
if (credentials.basicAuth) {
const urlObj = new url_1.URL(url);
if (!urlObj.username && !urlObj.password) {
({ username: urlObj.username, password: urlObj.password } = credentials.basicAuth);
requestUrl = urlObj.href;
}
}
if (agent)
options = Object.assign({ agent }, options);