Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Dec 11, 2024
1 parent 51b0702 commit 5c3328a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ declare module 'snowflake-sdk' {
/**
* The option to override the environment proxy value (HTTPS_PROXY) if the connection proxy is configured in GCS
*/
overrideEnvProxy?: string;
overrideEnvProxy?: boolean;
}

export interface Connection {
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports.getCompareAndLogEnvAndAgentProxies = function (agentOptions) {
' protocol=' + agentOptions.protocol + ' proxy=' + proxyHostAndPort
: ' proxy=' + proxyHostAndPort;
const proxyUsername = agentOptions.user ? ' user=' + agentOptions.user : '';
const proxyString = `${Util.exists(proxyUsername) ? `${agentOptions.user}:${agentOptions.password}@` : ''}${proxyHostAndPort}`.toLowerCase();
const proxyString = `${Util.exists(agentOptions.user) ? `${agentOptions.user}:${agentOptions.password}@` : ''}${proxyHostAndPort}`.toLowerCase();
logMessages.messages = logMessages.messages + ` // Proxy configured in Agent:${proxyProtocolHostAndPort}${proxyUsername}`;

// check if both the PROXY envvars and Connection proxy config is set
Expand Down
13 changes: 13 additions & 0 deletions test/unit/proxy_util_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ describe('ProxyUtil Test - removing http or https from string', () => {
});

describe('ProxyUtil Test - detecting PROXY envvars and compare with the agent proxy settings', () => {
let originalHttpProxy = null;
let originalHttpsProxy = null;

before(() => {
originalHttpProxy = process.env.HTTP_PROXY;
originalHttpsProxy = process.env.HTTPS_PROXY;
});

after(() => {
originalHttpProxy ? process.env.HTTP_PROXY = originalHttpProxy : delete process.env.HTTP_PROXY;
originalHttpsProxy ? process.env.HTTPS_PROXY = originalHttpsProxy : delete process.env.HTTPS_PROXY;
});

[
{
name: 'detect http_proxy envvar, no agent proxy',
Expand Down

0 comments on commit 5c3328a

Please sign in to comment.