File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1545,6 +1545,22 @@ describe('node-fetch', () => {
1545
1545
expect ( called ) . to . equal ( 2 ) ;
1546
1546
} ) ;
1547
1547
} ) ;
1548
+
1549
+ it ( "supports supplying a famliy option to the agent" , function ( ) {
1550
+ const url = `${ base } redirect/301` ;
1551
+ const families = [ ] ;
1552
+ const family = Symbol ( 'family' ) ;
1553
+ function lookupSpy ( hostname , options , callback ) {
1554
+ families . push ( options . family )
1555
+ return lookup ( hostname , { } , callback ) ;
1556
+ }
1557
+ const agent = http . Agent ( { lookup : lookupSpy , family } ) ;
1558
+ return fetch ( url , { agent } ) . then ( ( ) => {
1559
+ expect ( families ) . to . have . length ( 2 ) ;
1560
+ expect ( families [ 0 ] ) . to . equal ( family ) ;
1561
+ expect ( families [ 1 ] ) . to . equal ( family ) ;
1562
+ } ) ;
1563
+ } ) ;
1548
1564
} ) ;
1549
1565
1550
1566
describe ( 'Headers' , function ( ) {
You can’t perform that action at this time.
0 commit comments