File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -248,9 +248,7 @@ export class Ky {
248
248
return this . _retry ( fn ) ;
249
249
}
250
250
251
- if ( this . _options . throwHttpErrors ) {
252
- throw error ;
253
- }
251
+ throw error ;
254
252
}
255
253
}
256
254
Original file line number Diff line number Diff line change @@ -393,6 +393,26 @@ test('throwHttpErrors option with POST', async t => {
393
393
await server . close ( ) ;
394
394
} ) ;
395
395
396
+ test ( 'throwHttpErrors:false does not suppress timeout errors' , async t => {
397
+ let requestCount = 0 ;
398
+
399
+ const server = await createHttpTestServer ( ) ;
400
+ server . get ( '/' , async ( _request , response ) => {
401
+ requestCount ++ ;
402
+ await delay ( 1000 ) ;
403
+ response . sendStatus ( 500 ) ;
404
+ } ) ;
405
+
406
+ await t . throwsAsync (
407
+ ky ( server . url , { throwHttpErrors : false , timeout : 500 } ) . text ( ) ,
408
+ { instanceOf : ky . TimeoutError }
409
+ ) ;
410
+
411
+ t . is ( requestCount , 1 ) ;
412
+
413
+ await server . close ( ) ;
414
+ } ) ;
415
+
396
416
test ( 'ky.create()' , async t => {
397
417
const server = await createHttpTestServer ( ) ;
398
418
server . get ( '/' , ( request , response ) => {
You can’t perform that action at this time.
0 commit comments