@@ -135,45 +135,45 @@ test('request hwm', async (t) => {
135
135
await t . completed
136
136
} )
137
137
138
- // test('request abort before headers', async (t) => {
139
- // t = tspl(t, { plan: 6 })
140
-
141
- // const signal = new EE()
142
- // const server = createServer((req, res) => {
143
- // res.end('hello')
144
- // signal.emit('abort')
145
- // })
146
- // after(() => server.close())
147
-
148
- // server.listen(0, () => {
149
- // const client = new Client(`http://localhost:${server.address().port}`)
150
- // after(() => client.destroy())
151
-
152
- // client[kConnect](() => {
153
- // client.request({
154
- // path: '/',
155
- // method: 'GET',
156
- // signal
157
- // }, (err) => {
158
- // t.ok(err instanceof errors.RequestAbortedError)
159
- // t.strictEqual(signal.listenerCount('abort'), 0)
160
- // })
161
- // t.strictEqual(signal.listenerCount('abort'), 1)
162
-
163
- // client.request({
164
- // path: '/',
165
- // method: 'GET',
166
- // signal
167
- // }, (err) => {
168
- // t.ok(err instanceof errors.RequestAbortedError)
169
- // t.strictEqual(signal.listenerCount('abort'), 0)
170
- // })
171
- // t.strictEqual(signal.listenerCount('abort'), 2)
172
- // })
173
- // })
174
-
175
- // await t.completed
176
- // })
138
+ test ( 'request abort before headers' , async ( t ) => {
139
+ t = tspl ( t , { plan : 6 } )
140
+
141
+ const signal = new EE ( )
142
+ const server = createServer ( ( req , res ) => {
143
+ res . end ( 'hello' )
144
+ signal . emit ( 'abort' )
145
+ } )
146
+ after ( ( ) => server . close ( ) )
147
+
148
+ server . listen ( 0 , ( ) => {
149
+ const client = new Client ( `http://localhost:${ server . address ( ) . port } ` )
150
+ after ( ( ) => client . destroy ( ) )
151
+
152
+ client [ kConnect ] ( ( ) => {
153
+ client . request ( {
154
+ path : '/' ,
155
+ method : 'GET' ,
156
+ signal
157
+ } , ( err ) => {
158
+ t . ok ( err instanceof errors . RequestAbortedError )
159
+ t . strictEqual ( signal . listenerCount ( 'abort' ) , 0 )
160
+ } )
161
+ t . strictEqual ( signal . listenerCount ( 'abort' ) , 1 )
162
+
163
+ client . request ( {
164
+ path : '/' ,
165
+ method : 'GET' ,
166
+ signal
167
+ } , ( err ) => {
168
+ t . ok ( err instanceof errors . RequestAbortedError )
169
+ t . strictEqual ( signal . listenerCount ( 'abort' ) , 0 )
170
+ } )
171
+ t . strictEqual ( signal . listenerCount ( 'abort' ) , 2 )
172
+ } )
173
+ } )
174
+
175
+ await t . completed
176
+ } )
177
177
178
178
test ( 'request body destroyed on invalid callback' , async ( t ) => {
179
179
t = tspl ( t , { plan : 1 } )
0 commit comments