diff --git a/lib/agent.js b/lib/agent.js index 4eb2b4f6..74b6f47e 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -30,7 +30,7 @@ module.exports = function (log) { const proxyAuth = proxy.username && proxy.password ? `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}` : null; - log(`Via proxy ${proxy.protocol}://${proxy.hostname}:${proxy.port} ${proxyAuth ? 'with' : 'no'} credentials`); + log(`Via proxy ${proxy.protocol}//${proxy.hostname}:${proxy.port} ${proxyAuth ? 'with' : 'no'} credentials`); return tunnel({ proxy: { port: Number(proxy.port), diff --git a/test/unit/agent.js b/test/unit/agent.js index 99ba4825..95d58731 100644 --- a/test/unit/agent.js +++ b/test/unit/agent.js @@ -21,7 +21,7 @@ describe('HTTP agent', function () { assert.strictEqual(123, proxy.options.proxy.port); assert.strictEqual('user:pass', proxy.options.proxy.proxyAuth); assert.strictEqual(443, proxy.defaultPort); - assert.strictEqual(logMsg, 'Via proxy https:://secure:123 with credentials'); + assert.strictEqual(logMsg, 'Via proxy https://secure:123 with credentials'); }); it('HTTPS proxy with auth from HTTPS_PROXY using credentials containing special characters', function () { @@ -34,7 +34,7 @@ describe('HTTP agent', function () { assert.strictEqual(789, proxy.options.proxy.port); assert.strictEqual('user,:pass=', proxy.options.proxy.proxyAuth); assert.strictEqual(443, proxy.defaultPort); - assert.strictEqual(logMsg, 'Via proxy https:://secure:789 with credentials'); + assert.strictEqual(logMsg, 'Via proxy https://secure:789 with credentials'); }); it('HTTP proxy without auth from npm_config_proxy', function () { @@ -47,6 +47,6 @@ describe('HTTP agent', function () { assert.strictEqual(456, proxy.options.proxy.port); assert.strictEqual(null, proxy.options.proxy.proxyAuth); assert.strictEqual(443, proxy.defaultPort); - assert.strictEqual(logMsg, 'Via proxy http:://plaintext:456 no credentials'); + assert.strictEqual(logMsg, 'Via proxy http://plaintext:456 no credentials'); }); });