@@ -36,9 +36,11 @@ test('post abort signal', async (t) => {
3636
3737 server . listen ( 0 , async ( ) => {
3838 const ac = new AbortController ( )
39- const ures = await request ( `http://0.0.0.0:${ server . address ( ) . port } ` , { signal : ac . signal } )
39+ const uresPromise = request ( `http://0.0.0.0:${ server . address ( ) . port } ` , { signal : ac . signal } )
4040 ac . abort ( )
41+
4142 try {
43+ const ures = await uresPromise
4244 /* eslint-disable-next-line no-unused-vars */
4345 for await ( const chunk of ures . body ) {
4446 // Do nothing...
@@ -61,9 +63,11 @@ test('post abort signal w/ reason', async (t) => {
6163 server . listen ( 0 , async ( ) => {
6264 const ac = new AbortController ( )
6365 const _err = new Error ( )
64- const ures = await request ( `http://0.0.0.0:${ server . address ( ) . port } ` , { signal : ac . signal } )
66+ const uresPromise = request ( `http://0.0.0.0:${ server . address ( ) . port } ` , { signal : ac . signal } )
6567 ac . abort ( _err )
68+
6669 try {
70+ const ures = await uresPromise
6771 /* eslint-disable-next-line no-unused-vars */
6872 for await ( const chunk of ures . body ) {
6973 // Do nothing...
@@ -74,3 +78,20 @@ test('post abort signal w/ reason', async (t) => {
7478 } )
7579 await t . completed
7680} )
81+
82+ test ( 'post abort signal after request completed' , async ( t ) => {
83+ t = tspl ( t , { plan : 1 } )
84+
85+ const server = createServer ( ( req , res ) => {
86+ res . end ( 'asd' )
87+ } )
88+ after ( ( ) => server . close ( ) )
89+
90+ server . listen ( 0 , async ( ) => {
91+ const ac = new AbortController ( )
92+ const ures = await request ( `http://0.0.0.0:${ server . address ( ) . port } ` , { signal : ac . signal } )
93+ ac . abort ( )
94+ t . equal ( await ures . body . text ( ) , 'asd' )
95+ } )
96+ await t . completed
97+ } )
0 commit comments