Skip to content

Commit 8881567

Browse files
committed
be explicit about proxyTunnel status in each ProxyAgent test
1 parent f863865 commit 8881567

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/proxy-agent.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ test('use proxy-agent to connect through proxy using path with params', async (t
244244

245245
const serverUrl = `http://localhost:${server.address().port}`
246246
const proxyUrl = `http://localhost:${proxy.address().port}`
247-
const proxyAgent = new ProxyAgent(proxyUrl)
247+
const proxyAgent = new ProxyAgent({ uri: proxyUrl, proxyTunnel: false })
248248
const parsedOrigin = new URL(serverUrl)
249249

250250
proxy.on('connect', () => {
@@ -316,7 +316,7 @@ test('use proxy-agent to connect through proxy with basic auth in URL', async (t
316316

317317
const serverUrl = `http://localhost:${server.address().port}`
318318
const proxyUrl = new URL(`http://user:pass@localhost:${proxy.address().port}`)
319-
const proxyAgent = new ProxyAgent(proxyUrl)
319+
const proxyAgent = new ProxyAgent({ uri: proxyUrl, proxyTunnel: false })
320320
const parsedOrigin = new URL(serverUrl)
321321

322322
proxy.authenticate = function (req, fn) {
@@ -400,7 +400,8 @@ test('use proxy-agent with auth', async (t) => {
400400
const proxyUrl = `http://localhost:${proxy.address().port}`
401401
const proxyAgent = new ProxyAgent({
402402
auth: Buffer.from('user:pass').toString('base64'),
403-
uri: proxyUrl
403+
uri: proxyUrl,
404+
proxyTunnel: false
404405
})
405406
const parsedOrigin = new URL(serverUrl)
406407

@@ -489,7 +490,8 @@ test('use proxy-agent with token', async (t) => {
489490
const proxyUrl = `http://localhost:${proxy.address().port}`
490491
const proxyAgent = new ProxyAgent({
491492
token: `Bearer ${Buffer.from('user:pass').toString('base64')}`,
492-
uri: proxyUrl
493+
uri: proxyUrl,
494+
proxyTunnel: false
493495
})
494496
const parsedOrigin = new URL(serverUrl)
495497

@@ -578,6 +580,7 @@ test('use proxy-agent with custom headers', async (t) => {
578580
const proxyUrl = `http://localhost:${proxy.address().port}`
579581
const proxyAgent = new ProxyAgent({
580582
uri: proxyUrl,
583+
proxyTunnel: false,
581584
headers: {
582585
'User-Agent': 'Foobar/1.0.0'
583586
}
@@ -702,7 +705,7 @@ test('use proxy-agent with setGlobalDispatcher', async (t) => {
702705

703706
const serverUrl = `http://localhost:${server.address().port}`
704707
const proxyUrl = `http://localhost:${proxy.address().port}`
705-
const proxyAgent = new ProxyAgent(proxyUrl)
708+
const proxyAgent = new ProxyAgent({ uri: proxyUrl, proxyTunnel: false })
706709
const parsedOrigin = new URL(serverUrl)
707710
setGlobalDispatcher(proxyAgent)
708711

@@ -786,7 +789,7 @@ test('ProxyAgent correctly sends headers when using fetch - #1355, #1623', async
786789
const serverUrl = `http://localhost:${server.address().port}`
787790
const proxyUrl = `http://localhost:${proxy.address().port}`
788791

789-
const proxyAgent = new ProxyAgent(proxyUrl)
792+
const proxyAgent = new ProxyAgent({ uri: proxyUrl, proxyTunnel: false })
790793
setGlobalDispatcher(proxyAgent)
791794

792795
after(() => setGlobalDispatcher(defaultDispatcher))
@@ -896,7 +899,7 @@ test('should throw when proxy does not return 200', async (t) => {
896899
return false
897900
}
898901

899-
const proxyAgent = new ProxyAgent(proxyUrl)
902+
const proxyAgent = new ProxyAgent({ uri: proxyUrl, proxyTunnel: false })
900903
try {
901904
await request(serverUrl, { dispatcher: proxyAgent })
902905
t.fail()

0 commit comments

Comments
 (0)