@@ -61,7 +61,7 @@ describe('WebSocket', () => {
61
61
} ) ;
62
62
63
63
it ( 'accepts `url.URL` objects as url' , ( done ) => {
64
- const agent = new CustomAgent ( ) ;
64
+ const agent = new http . Agent ( ) ;
65
65
66
66
agent . addRequest = ( req , opts ) => {
67
67
assert . strictEqual ( opts . host , '::1' ) ;
@@ -74,7 +74,7 @@ describe('WebSocket', () => {
74
74
75
75
describe ( 'options' , ( ) => {
76
76
it ( 'accepts the `options` object as 3rd argument' , ( ) => {
77
- const agent = new CustomAgent ( ) ;
77
+ const agent = new http . Agent ( ) ;
78
78
let count = 0 ;
79
79
let ws ;
80
80
@@ -122,10 +122,8 @@ describe('WebSocket', () => {
122
122
} ) ;
123
123
124
124
it ( 'throws an error when using an invalid `protocolVersion`' , ( ) => {
125
- const options = { agent : new CustomAgent ( ) , protocolVersion : 1000 } ;
126
-
127
125
assert . throws (
128
- ( ) => new WebSocket ( 'ws://localhost' , options ) ,
126
+ ( ) => new WebSocket ( 'ws://localhost' , { protocolVersion : 1000 } ) ,
129
127
/ ^ R a n g e E r r o r : U n s u p p o r t e d p r o t o c o l v e r s i o n : 1 0 0 0 \( s u p p o r t e d v e r s i o n s : 8 , 1 3 \) $ /
130
128
) ;
131
129
} ) ;
@@ -3709,7 +3707,7 @@ describe('WebSocket', () => {
3709
3707
3710
3708
describe ( 'Request headers' , ( ) => {
3711
3709
it ( 'adds the authorization header if the url has userinfo' , ( done ) => {
3712
- const agent = new CustomAgent ( ) ;
3710
+ const agent = new http . Agent ( ) ;
3713
3711
const userinfo = 'test:testpass' ;
3714
3712
3715
3713
agent . addRequest = ( req ) => {
@@ -3724,7 +3722,7 @@ describe('WebSocket', () => {
3724
3722
} ) ;
3725
3723
3726
3724
it ( 'honors the `auth` option' , ( done ) => {
3727
- const agent = new CustomAgent ( ) ;
3725
+ const agent = new http . Agent ( ) ;
3728
3726
const auth = 'user:pass' ;
3729
3727
3730
3728
agent . addRequest = ( req ) => {
@@ -3739,7 +3737,7 @@ describe('WebSocket', () => {
3739
3737
} ) ;
3740
3738
3741
3739
it ( 'favors the url userinfo over the `auth` option' , ( done ) => {
3742
- const agent = new CustomAgent ( ) ;
3740
+ const agent = new http . Agent ( ) ;
3743
3741
const auth = 'foo:bar' ;
3744
3742
const userinfo = 'baz:qux' ;
3745
3743
@@ -3755,7 +3753,7 @@ describe('WebSocket', () => {
3755
3753
} ) ;
3756
3754
3757
3755
it ( 'adds custom headers' , ( done ) => {
3758
- const agent = new CustomAgent ( ) ;
3756
+ const agent = new http . Agent ( ) ;
3759
3757
3760
3758
agent . addRequest = ( req ) => {
3761
3759
assert . strictEqual ( req . getHeader ( 'cookie' ) , 'foo=bar' ) ;
@@ -3784,7 +3782,7 @@ describe('WebSocket', () => {
3784
3782
} ) ;
3785
3783
3786
3784
it ( "doesn't add the origin header by default" , ( done ) => {
3787
- const agent = new CustomAgent ( ) ;
3785
+ const agent = new http . Agent ( ) ;
3788
3786
3789
3787
agent . addRequest = ( req ) => {
3790
3788
assert . strictEqual ( req . getHeader ( 'origin' ) , undefined ) ;
@@ -3795,7 +3793,7 @@ describe('WebSocket', () => {
3795
3793
} ) ;
3796
3794
3797
3795
it ( 'honors the `origin` option (1/2)' , ( done ) => {
3798
- const agent = new CustomAgent ( ) ;
3796
+ const agent = new http . Agent ( ) ;
3799
3797
3800
3798
agent . addRequest = ( req ) => {
3801
3799
assert . strictEqual ( req . getHeader ( 'origin' ) , 'https://example.com:8000' ) ;
@@ -3809,7 +3807,7 @@ describe('WebSocket', () => {
3809
3807
} ) ;
3810
3808
3811
3809
it ( 'honors the `origin` option (2/2)' , ( done ) => {
3812
- const agent = new CustomAgent ( ) ;
3810
+ const agent = new http . Agent ( ) ;
3813
3811
3814
3812
agent . addRequest = ( req ) => {
3815
3813
assert . strictEqual (
@@ -3860,7 +3858,7 @@ describe('WebSocket', () => {
3860
3858
3861
3859
describe ( 'permessage-deflate' , ( ) => {
3862
3860
it ( 'is enabled by default' , ( done ) => {
3863
- const agent = new CustomAgent ( ) ;
3861
+ const agent = new http . Agent ( ) ;
3864
3862
3865
3863
agent . addRequest = ( req ) => {
3866
3864
assert . strictEqual (
@@ -3874,7 +3872,7 @@ describe('WebSocket', () => {
3874
3872
} ) ;
3875
3873
3876
3874
it ( 'can be disabled' , ( done ) => {
3877
- const agent = new CustomAgent ( ) ;
3875
+ const agent = new http . Agent ( ) ;
3878
3876
3879
3877
agent . addRequest = ( req ) => {
3880
3878
assert . strictEqual (
@@ -3891,7 +3889,7 @@ describe('WebSocket', () => {
3891
3889
} ) ;
3892
3890
3893
3891
it ( 'can send extension parameters' , ( done ) => {
3894
- const agent = new CustomAgent ( ) ;
3892
+ const agent = new http . Agent ( ) ;
3895
3893
3896
3894
const value =
3897
3895
'permessage-deflate; server_no_context_takeover;' +
0 commit comments