Skip to content

Commit eac22ea

Browse files
committed
rename to proxyTunnel to match CURL
1 parent f2cdce6 commit eac22ea

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/dispatcher/proxy-agent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ProxyAgent extends DispatcherBase {
9393
throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
9494
}
9595

96-
const { tunnelProxy = true } = opts
96+
const { proxyTunnel = true } = opts
9797

9898
super()
9999

@@ -116,7 +116,7 @@ class ProxyAgent extends DispatcherBase {
116116
this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
117117
}
118118

119-
const factory = (!tunnelProxy && protocol === 'http:')
119+
const factory = (!proxyTunnel && protocol === 'http:')
120120
? (origin, options) => {
121121
if (origin.protocol === 'http:') {
122122
return new ProxyClient(origin, options)
@@ -128,7 +128,7 @@ class ProxyAgent extends DispatcherBase {
128128
const connect = buildConnector({ ...opts.proxyTls })
129129
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
130130
this[kClient] = clientFactory(url, { connect, factory })
131-
this[kTunnelProxy] = tunnelProxy
131+
this[kTunnelProxy] = proxyTunnel
132132
this[kAgent] = new Agent({
133133
...opts,
134134
connect: async (opts, callback) => {

test/proxy-agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ test('Proxy via HTTP to HTTP endpoint with tunneling disabled', async (t) => {
800800

801801
const serverUrl = `http://localhost:${server.address().port}`
802802
const proxyUrl = `http://localhost:${proxy.address().port}`
803-
const proxyAgent = new ProxyAgent({ uri: proxyUrl, tunnelProxy: false })
803+
const proxyAgent = new ProxyAgent({ uri: proxyUrl, proxyTunnel: false })
804804

805805
server.on('request', function (req, res) {
806806
t.ok(!req.connection.encrypted)
@@ -817,7 +817,7 @@ test('Proxy via HTTP to HTTP endpoint with tunneling disabled', async (t) => {
817817
})
818818

819819
proxy.on('connect', () => {
820-
t.fail(true, 'connect to proxy should unreachable if tunnelProxy is false')
820+
t.fail(true, 'connect to proxy should unreachable if proxyTunnel is false')
821821
})
822822

823823
proxy.on('request', function (req) {

types/proxy-agent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ declare namespace ProxyAgent {
2424
requestTls?: buildConnector.BuildOptions;
2525
proxyTls?: buildConnector.BuildOptions;
2626
clientFactory?(origin: URL, opts: object): Dispatcher;
27-
tunnelProxy?: boolean;
27+
proxyTunnel?: boolean;
2828
}
2929
}

0 commit comments

Comments
 (0)