Logging: fix notation of proxy URL (#3615)

This commit is contained in:
TomWis97 2023-04-07 13:19:04 +02:00 committed by GitHub
parent e87204b92c
commit 9ebbcc3701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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),

View File

@ -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');
});
});