@@ -20,6 +20,12 @@ test('handle headers as array', async (t) => {
2020 const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
2121 after ( ( ) => client . close ( ) )
2222
23+ client . on ( 'disconnect' , ( ) => {
24+ if ( ! client . closed && ! client . destroyed ) {
25+ t . fail ( 'unexpected disconnect' )
26+ }
27+ } )
28+
2329 client . request ( {
2430 path : '/' ,
2531 method : 'GET' ,
@@ -46,6 +52,12 @@ test('handle multi-valued headers as array', async (t) => {
4652 const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
4753 after ( ( ) => client . close ( ) )
4854
55+ client . on ( 'disconnect' , ( ) => {
56+ if ( ! client . closed && ! client . destroyed ) {
57+ t . fail ( 'unexpected disconnect' )
58+ }
59+ } )
60+
4961 client . request ( {
5062 path : '/' ,
5163 method : 'GET' ,
@@ -72,6 +84,12 @@ test('handle headers with array', async (t) => {
7284 const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
7385 after ( ( ) => client . close ( ) )
7486
87+ client . on ( 'disconnect' , ( ) => {
88+ if ( ! client . closed && ! client . destroyed ) {
89+ t . fail ( 'unexpected disconnect' )
90+ }
91+ } )
92+
7593 client . request ( {
7694 path : '/' ,
7795 method : 'GET' ,
@@ -98,6 +116,12 @@ test('handle multi-valued headers', async (t) => {
98116 const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
99117 after ( ( ) => client . close ( ) )
100118
119+ client . on ( 'disconnect' , ( ) => {
120+ if ( ! client . closed && ! client . destroyed ) {
121+ t . fail ( 'unexpected disconnect' )
122+ }
123+ } )
124+
101125 client . request ( {
102126 path : '/' ,
103127 method : 'GET' ,
@@ -118,6 +142,12 @@ test('fail if headers array is odd', async (t) => {
118142 const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
119143 after ( ( ) => client . close ( ) )
120144
145+ client . on ( 'disconnect' , ( ) => {
146+ if ( ! client . closed && ! client . destroyed ) {
147+ t . fail ( 'unexpected disconnect' )
148+ }
149+ } )
150+
121151 client . request ( {
122152 path : '/' ,
123153 method : 'GET' ,
@@ -141,6 +171,12 @@ test('fail if headers is not an object or an array', async (t) => {
141171 const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
142172 after ( ( ) => client . close ( ) )
143173
174+ client . on ( 'disconnect' , ( ) => {
175+ if ( ! client . closed && ! client . destroyed ) {
176+ t . fail ( 'unexpected disconnect' )
177+ }
178+ } )
179+
144180 client . request ( {
145181 path : '/' ,
146182 method : 'GET' ,
0 commit comments