File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,8 @@ function prepare(input){
103
103
let auth = input . headers . auth || { } ;
104
104
let settings = {
105
105
autoHeaders : ! input . headers [ 'no-auto' ] || false ,
106
- cookies : input . headers . cookies || false ,
107
- timeout : input . timeout || false ,
106
+ cookies : input . cookies || input . headers . cookies || false ,
107
+ timeout : input . timeout || input . headers . timeout || false ,
108
108
109
109
auth : auth . username || url . username ? {
110
110
username : auth . username || url . username ,
Original file line number Diff line number Diff line change @@ -237,13 +237,7 @@ describe('Assertions', function(){
237
237
238
238
describe ( 'Timeout' , function ( ) {
239
239
240
- it ( 'Should reject when response time exceeds setup timeout' , function ( ) {
241
- assert . rejects ( ( ) => muhb . request ( {
242
- method : 'GET' ,
243
- url : HTTPBIN_URL + '/delay/10000' ,
244
- timeout : 1000
245
- } ) , / t i m e o u t / g) ;
246
- } ) ;
240
+
247
241
248
242
} ) ;
249
243
@@ -379,4 +373,18 @@ describe('Other Features', function(){
379
373
assert . strictEqual ( body . length , 16 ) ;
380
374
} ) ;
381
375
376
+ it ( 'Should reject when response time exceeds setup timeout' , async function ( ) {
377
+ await assert . rejects ( ( ) => muhb . request ( {
378
+ method : 'GET' ,
379
+ url : HTTPBIN_URL + '/delay/10000' ,
380
+ timeout : 500
381
+ } ) , / t i m e o u t / g) ;
382
+
383
+ await assert . rejects ( ( ) => muhb . request ( {
384
+ method : 'GET' ,
385
+ url : HTTPBIN_URL + '/delay/10000' ,
386
+ headers : { timeout : 500 }
387
+ } ) , / t i m e o u t / g) ;
388
+ } ) ;
389
+
382
390
} ) ;
You can’t perform that action at this time.
0 commit comments