mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Logging: fix notation of proxy URL (#3615)
This commit is contained in:
parent
e87204b92c
commit
9ebbcc3701
@ -30,7 +30,7 @@ module.exports = function (log) {
|
|||||||
const proxyAuth = proxy.username && proxy.password
|
const proxyAuth = proxy.username && proxy.password
|
||||||
? `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`
|
? `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`
|
||||||
: null;
|
: 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({
|
return tunnel({
|
||||||
proxy: {
|
proxy: {
|
||||||
port: Number(proxy.port),
|
port: Number(proxy.port),
|
||||||
|
@ -21,7 +21,7 @@ describe('HTTP agent', function () {
|
|||||||
assert.strictEqual(123, proxy.options.proxy.port);
|
assert.strictEqual(123, proxy.options.proxy.port);
|
||||||
assert.strictEqual('user:pass', proxy.options.proxy.proxyAuth);
|
assert.strictEqual('user:pass', proxy.options.proxy.proxyAuth);
|
||||||
assert.strictEqual(443, proxy.defaultPort);
|
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 () {
|
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(789, proxy.options.proxy.port);
|
||||||
assert.strictEqual('user,:pass=', proxy.options.proxy.proxyAuth);
|
assert.strictEqual('user,:pass=', proxy.options.proxy.proxyAuth);
|
||||||
assert.strictEqual(443, proxy.defaultPort);
|
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 () {
|
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(456, proxy.options.proxy.port);
|
||||||
assert.strictEqual(null, proxy.options.proxy.proxyAuth);
|
assert.strictEqual(null, proxy.options.proxy.proxyAuth);
|
||||||
assert.strictEqual(443, proxy.defaultPort);
|
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user