@@ -181,7 +181,7 @@ t.test('get proxy uri', async t => {
181
181
182
182
t . test ( 'get proxy agent' , async t => {
183
183
const { getProxy } = agent
184
- const OPTS = {
184
+ const PROXY_OPTS = {
185
185
ca : 'ca' ,
186
186
cert : 'cert' ,
187
187
keyu : 'key' ,
@@ -191,7 +191,7 @@ t.test('get proxy agent', async t => {
191
191
rejectUnauthorized : true ,
192
192
}
193
193
194
- t . strictSame ( getProxy ( new url . URL ( 'http://proxy.local:443/' ) , OPTS , true ) , {
194
+ t . strictSame ( getProxy ( new url . URL ( 'http://proxy.local:443/' ) , PROXY_OPTS , true ) , {
195
195
host : 'proxy.local' ,
196
196
port : '443' ,
197
197
protocol : 'http:' ,
@@ -207,7 +207,7 @@ t.test('get proxy agent', async t => {
207
207
__type : 'https-proxy' ,
208
208
} , 'http proxy url, for https request' )
209
209
210
- t . strictSame ( getProxy ( new url . URL ( 'https://proxy.local:443/' ) , OPTS , true ) , {
210
+ t . strictSame ( getProxy ( new url . URL ( 'https://proxy.local:443/' ) , PROXY_OPTS , true ) , {
211
211
host : 'proxy.local' ,
212
212
port : '' ,
213
213
protocol : 'https:' ,
@@ -223,7 +223,7 @@ t.test('get proxy agent', async t => {
223
223
__type : 'https-proxy' ,
224
224
} , 'https proxy url, for https request' )
225
225
226
- t . strictSame ( getProxy ( new url . URL ( 'socks://proxy.local:443/' ) , OPTS , true ) , {
226
+ t . strictSame ( getProxy ( new url . URL ( 'socks://proxy.local:443/' ) , PROXY_OPTS , true ) , {
227
227
host : 'proxy.local' ,
228
228
port : '443' ,
229
229
protocol : 'socks:' ,
@@ -239,7 +239,7 @@ t.test('get proxy agent', async t => {
239
239
__type : 'socks-proxy' ,
240
240
} , 'socks proxy url, for https request' )
241
241
242
- t . strictSame ( getProxy ( new url . URL ( 'http://proxy.local:443/' ) , OPTS , false ) , {
242
+ t . strictSame ( getProxy ( new url . URL ( 'http://proxy.local:443/' ) , PROXY_OPTS , false ) , {
243
243
host : 'proxy.local' ,
244
244
port : '443' ,
245
245
protocol : 'http:' ,
@@ -255,7 +255,7 @@ t.test('get proxy agent', async t => {
255
255
__type : 'http-proxy' ,
256
256
} , 'http proxy url, for http request' )
257
257
258
- t . strictSame ( getProxy ( new url . URL ( 'https://proxy.local:443/' ) , OPTS , false ) , {
258
+ t . strictSame ( getProxy ( new url . URL ( 'https://proxy.local:443/' ) , PROXY_OPTS , false ) , {
259
259
host : 'proxy.local' ,
260
260
port : '' ,
261
261
protocol : 'https:' ,
@@ -271,7 +271,7 @@ t.test('get proxy agent', async t => {
271
271
__type : 'http-proxy' ,
272
272
} , 'https proxy url, for http request' )
273
273
274
- t . strictSame ( getProxy ( new url . URL ( 'socks://proxy.local:443/' ) , OPTS , false ) , {
274
+ t . strictSame ( getProxy ( new url . URL ( 'socks://proxy.local:443/' ) , PROXY_OPTS , false ) , {
275
275
host : 'proxy.local' ,
276
276
port : '443' ,
277
277
protocol : 'socks:' ,
@@ -287,7 +287,7 @@ t.test('get proxy agent', async t => {
287
287
__type : 'socks-proxy' ,
288
288
} , 'socks proxy url, for http request' )
289
289
290
- t . strictSame ( getProxy ( new url . URL ( 'http://user:pass@proxy.local:443/' ) , OPTS , false ) , {
290
+ t . strictSame ( getProxy ( new url . URL ( 'http://user:pass@proxy.local:443/' ) , PROXY_OPTS , false ) , {
291
291
host : 'proxy.local' ,
292
292
port : '443' ,
293
293
protocol : 'http:' ,
@@ -303,7 +303,7 @@ t.test('get proxy agent', async t => {
303
303
__type : 'http-proxy' ,
304
304
} , 'http proxy url, for http request' )
305
305
306
- t . strictSame ( getProxy ( new url . URL ( 'http://user@proxy.local:443/' ) , OPTS , false ) , {
306
+ t . strictSame ( getProxy ( new url . URL ( 'http://user@proxy.local:443/' ) , PROXY_OPTS , false ) , {
307
307
host : 'proxy.local' ,
308
308
port : '443' ,
309
309
protocol : 'http:' ,
@@ -319,7 +319,7 @@ t.test('get proxy agent', async t => {
319
319
__type : 'http-proxy' ,
320
320
} , 'http proxy url, for http request' )
321
321
322
- t . strictSame ( getProxy ( new url . URL ( 'http://user%231:pass@proxy.local:443/' ) , OPTS , false ) , {
322
+ t . strictSame ( getProxy ( new url . URL ( 'http://user%231:pass@proxy.local:443/' ) , PROXY_OPTS , false ) , {
323
323
host : 'proxy.local' ,
324
324
port : '443' ,
325
325
protocol : 'http:' ,
@@ -335,23 +335,25 @@ t.test('get proxy agent', async t => {
335
335
__type : 'http-proxy' ,
336
336
} , 'http proxy url, for http request' )
337
337
338
- t . strictSame ( getProxy ( new url . URL ( 'http://user%231:pass%231@proxy.local:443/' ) , OPTS , false ) , {
339
- host : 'proxy.local' ,
340
- port : '443' ,
341
- protocol : 'http:' ,
342
- path : '/' ,
343
- auth : 'user#1:pass#1' ,
344
- ca : 'ca' ,
345
- cert : 'cert' ,
346
- key : undefined ,
347
- timeout : 2 ,
348
- localAddress : 'local address' ,
349
- maxSockets : 3 ,
350
- rejectUnauthorized : true ,
351
- __type : 'http-proxy' ,
352
- } , 'http proxy url, for http request' )
353
-
354
- t . throws ( ( ) => getProxy ( new url . URL ( 'gopher://proxy.local' ) , OPTS , false ) , {
338
+ t . strictSame (
339
+ getProxy ( new url . URL ( 'http://user%231:pass%231@proxy.local:443/' ) , PROXY_OPTS , false ) ,
340
+ {
341
+ host : 'proxy.local' ,
342
+ port : '443' ,
343
+ protocol : 'http:' ,
344
+ path : '/' ,
345
+ auth : 'user#1:pass#1' ,
346
+ ca : 'ca' ,
347
+ cert : 'cert' ,
348
+ key : undefined ,
349
+ timeout : 2 ,
350
+ localAddress : 'local address' ,
351
+ maxSockets : 3 ,
352
+ rejectUnauthorized : true ,
353
+ __type : 'http-proxy' ,
354
+ } , 'http proxy url, for http request' )
355
+
356
+ t . throws ( ( ) => getProxy ( new url . URL ( 'gopher://proxy.local' ) , PROXY_OPTS , false ) , {
355
357
message : 'unsupported proxy protocol: \'gopher:\'' ,
356
358
code : 'EUNSUPPORTEDPROXY' ,
357
359
url : 'gopher://proxy.local' ,
0 commit comments