@@ -63,7 +63,7 @@ function RequestSuite () {
63
63
64
64
testDeleteMethod : function ( ) {
65
65
var path = '/lol' ;
66
- var res = request . delete ( buildUrl ( path ) ) ;
66
+ var res = request . delete ( buildUrl ( path ) , { timeout : 300 } ) ;
67
67
expect ( res ) . to . be . a ( request . Response ) ;
68
68
expect ( res . body ) . to . be . a ( 'string' ) ;
69
69
expect ( Number ( res . headers [ 'content-length' ] ) ) . to . equal ( res . rawBody . length ) ;
@@ -77,7 +77,7 @@ function RequestSuite () {
77
77
78
78
testGetMethod : function ( ) {
79
79
var path = '/lol' ;
80
- var res = request . get ( buildUrl ( path ) ) ;
80
+ var res = request . get ( buildUrl ( path ) , { timeout : 300 } ) ;
81
81
expect ( res ) . to . be . a ( request . Response ) ;
82
82
expect ( res . body ) . to . be . a ( 'string' ) ;
83
83
expect ( Number ( res . headers [ 'content-length' ] ) ) . to . equal ( res . rawBody . length ) ;
@@ -91,7 +91,7 @@ function RequestSuite () {
91
91
92
92
testHeadMethod : function ( ) {
93
93
var path = '/lol' ;
94
- var res = request . head ( buildUrl ( path ) ) ;
94
+ var res = request . head ( buildUrl ( path ) , { timeout : 300 } ) ;
95
95
expect ( res ) . to . be . a ( request . Response ) ;
96
96
expect ( res . body ) . to . be . empty ( ) ;
97
97
} ,
@@ -102,7 +102,7 @@ function RequestSuite () {
102
102
103
103
testPostMethod : function ( ) {
104
104
var path = '/lol' ;
105
- var res = request . post ( buildUrl ( path ) ) ;
105
+ var res = request . post ( buildUrl ( path ) , { timeout : 300 } ) ;
106
106
expect ( res ) . to . be . a ( request . Response ) ;
107
107
expect ( res . body ) . to . be . a ( 'string' ) ;
108
108
expect ( Number ( res . headers [ 'content-length' ] ) ) . to . equal ( res . rawBody . length ) ;
@@ -117,7 +117,7 @@ function RequestSuite () {
117
117
testPatchMethod : function ( ) {
118
118
var path = '/lol' ;
119
119
var body = { hello : 'world' } ;
120
- var res = request . post ( buildUrl ( path ) , { body : body , json : true } ) ;
120
+ var res = request . post ( buildUrl ( path ) , { body : body , json : true , timeout : 300 } ) ;
121
121
expect ( res ) . to . be . a ( request . Response ) ;
122
122
expect ( Number ( res . headers [ 'content-length' ] ) ) . to . equal ( res . rawBody . length ) ;
123
123
expect ( res . body ) . to . be . an ( 'object' ) ;
@@ -134,7 +134,7 @@ function RequestSuite () {
134
134
testPutMethod : function ( ) {
135
135
var path = '/lol' ;
136
136
var body
1E0A
= { hello : 'world' } ;
137
- var res = request . put ( buildUrl ( path ) , { body : body , json : true } ) ;
137
+ var res = request . put ( buildUrl ( path ) , { body : body , json : true , timeout : 300 } ) ;
138
138
expect ( res ) . to . be . a ( request . Response ) ;
139
139
expect ( Number ( res . headers [ 'content-length' ] ) )
F438
. to . equal ( res . rawBody . length ) ;
140
140
expect ( res . body ) . to . be . an ( 'object' ) ;
@@ -155,7 +155,7 @@ function RequestSuite () {
155
155
'content-disposition' : 'x-chaotic; mood=cheerful' ,
156
156
'x-hovercraft' : 'full-of-eels'
157
157
} ;
158
- var res = request . post ( buildUrl ( path ) , { headers : headers } ) ;
158
+ var res = request . post ( buildUrl ( path ) , { headers : headers , timeout : 300 } ) ;
159
159
expect ( res ) . to . be . a ( request . Response ) ;
160
160
var obj = JSON . parse ( res . body ) ;
161
161
expect ( obj . path ) . to . equal ( path ) ;
@@ -174,7 +174,7 @@ function RequestSuite () {
174
174
var qstring = {
175
175
hovercraft : [ 'full' , 'of' , 'eels' ]
176
176
} ;
177
- var res = request . post ( buildUrl ( path ) , { qs : qstring } ) ;
177
+ var res = request . post ( buildUrl ( path ) , { qs : qstring , timeout : 300 } ) ;
178
178
expect ( res ) . to . be . a ( request . Response ) ;
179
179
var obj = JSON . parse ( res . body ) ;
180
180
var urlObj = url . parse ( obj . url ) ;
@@ -187,7 +187,7 @@ function RequestSuite () {
187
187
var qstring = {
188
188
hovercraft : [ 'full' , 'of' , 'eels' ]
189
189
} ;
190
- var res = request . post ( buildUrl ( path ) , { qs : qstring , useQuerystring : true } ) ;
190
+ var res = request . post ( buildUrl ( path ) , { qs : qstring , useQuerystring : true , timeout : 300 } ) ;
191
191
expect ( res ) . to . be . a ( request . Response ) ;
192
192
var obj = JSON . parse ( res . body ) ;
193
193
var urlObj = url . parse ( obj . url ) ;
@@ -200,7 +200,7 @@ function RequestSuite () {
200
200
var qstring = qs . stringify ( {
201
201
hovercraft : [ 'full' , 'of' , 'eels' ]
202
202
} ) ;
203
- var res = request . post ( buildUrl ( path ) , { qs : qstring } ) ;
203
+ var res = request . post ( buildUrl ( path ) , { qs : qstring , timeout : 300 } ) ;
204
204
expect ( res ) . to . be . a ( request . Response ) ;
205
205
var obj = JSON . parse ( res . body ) ;
206
206
var urlObj = url . parse ( obj . url ) ;
@@ -238,7 +238,7 @@ function RequestSuite () {
238
238
239
239
testBadJson : function ( ) {
240
240
var url = buildUrl ( '/_admin/aardvark/standalone.html' , false ) ;
241
- var res = request . get ( url , { json : true } ) ;
241
+ var res = request . get ( url , { json : true , timeout : 300 } ) ;
242
242
expect ( res ) . to . be . a ( request . Response ) ;
243
243
expect ( res . body ) . to . be . a ( 'string' ) ;
244
244
} ,
@@ -253,7 +253,7 @@ function RequestSuite () {
253
253
username : 'jcd' ,
254
254
password : 'bionicman'
255
255
} ;
256
- var res = request . post ( buildUrl ( path ) , { auth : auth } ) ;
256
+ var res = request . post ( buildUrl ( path ) , { auth : auth , timeout : 300 } ) ;
257
257
expect ( res ) . to . be . a ( request . Response ) ;
258
258
var obj = JSON . parse ( res . body ) ;
259
259
expect ( obj . path ) . to . equal ( path ) ;
@@ -272,7 +272,7 @@ function RequestSuite () {
272
272
} ;
273
273
var res = request . post ( buildUrl ( path ) . replace ( / ^ ( h t t p s ? : \/ \/ ) / , function ( m ) {
274
274
return m + encodeURIComponent ( auth . username ) + ':' + encodeURIComponent ( auth . password ) + '@' ;
275
- } ) ) ;
275
+ } ) , { timeout : 300 } ) ;
276
276
expect ( res ) . to . be . a ( request . Response ) ;
277
277
var obj = JSON . parse ( res . body ) ;
278
278
expect ( obj . path ) . to . equal ( path ) ;
@@ -288,7 +288,7 @@ function RequestSuite () {
288
288
var auth = {
289
289
bearer : 'full of bears'
290
290
} ;
291
- var res = request . post ( buildUrl ( path ) , { auth : auth } ) ;
291
+ var res = request . post ( buildUrl ( path ) , { auth : auth , timeout : 300 } ) ;
292
292
expect ( res ) . to . be . a ( request . Response ) ;
293
293
var obj = JSON . parse ( res . body ) ;
294
294
expect ( obj . path ) . to . equal ( path ) ;
@@ -308,7 +308,7 @@ function RequestSuite () {
308
308
answer : 42 ,
309
309
hovercraft : [ 'full' , 'of' , 'eels' ]
310
310
} ;
311
- var res = request . post ( buildUrl ( path ) , { body : reqBody , json : true } ) ;
311
+ var res = request . post ( buildUrl ( path ) , { body : reqBody , json : true , timeout : 300 } ) ;
312
312
expect ( res ) . to . be . a ( request . Response ) ;
313
313
expect ( res . body ) . to . be . an ( 'object' ) ;
314
314
var obj = res . body ;
@@ -324,7 +324,7 @@ function RequestSuite () {
324
324
answer : '42' ,
325
325
hovercraft : [ 'full' , 'of' , 'eels' ]
326
326
} ;
327
- var res = request . post ( buildUrl ( path ) , { form : reqBody } ) ;
327
+ var res = request . post ( buildUrl ( path ) , { form : reqBody , timeout : 300 } ) ;
328
328
expect ( res ) . to . be . a ( request . Response ) ;
329
329
var obj = JSON . parse ( res . body ) ;
330
330
expect ( obj . path ) . to . equal ( path ) ;
@@ -339,7 +339,7 @@ function RequestSuite () {
339
339
answer : '42' ,
340
340
hovercraft : [ 'full' , 'of' , 'eels' ]
341
341
} ;
342
- var res = request . post ( buildUrl ( path ) , { form : reqBody , useQuerystring : true } ) ;
342
+ var res = request . post ( buildUrl ( path ) , { form : reqBody , useQuerystring : true , timeout : 300 } ) ;
343
343
expect ( res ) . to . be . a ( request . Response ) ;
344
344
var obj = JSON . parse ( res . body ) ;
345
345
expect ( obj . path ) . to . equal ( path ) ;
@@ -354,7 +354,7 @@ function RequestSuite () {
354
354
answer : '42' ,
355
355
hovercraft : [ 'full' , 'of' , 'eels' ]
356
356
} ;
357
- var res = request . post ( buildUrl ( path ) , { form : qs . stringify ( reqBody ) } ) ;
357
+ var res = request . post ( buildUrl ( path ) , { form : qs . stringify ( reqBody ) , timeout : 300 } ) ;
358
358
expect ( res ) . to . be . a ( request . Response ) ;
359
359
var obj = JSON . parse ( res . body ) ;
360
360
expect ( obj . path ) . to . equal ( path ) ;
@@ -365,7 +365,7 @@ function RequestSuite () {
365
365
testStringBody : function ( ) {
366
366
var path = '/lol' ;
367
367
var reqBody = 'hello world' ;
368
- var res = request . post ( buildUrl ( path ) , { body : reqBody } ) ;
368
+ var res = request . post ( buildUrl ( path ) , { body : reqBody , timeout : 300 } ) ;
369
369
expect ( res ) . to . be . a ( request . Response ) ;
370
370
var obj = JSON . parse ( res . body ) ;
371
371
expect ( obj . path ) . to . equal ( path ) ;
@@ -377,7 +377,7 @@ function RequestSuite () {
377
377
var path = '/lol' ;
378
378
var reqBody = new Buffer ( 'hello world' ) ;
379
379
var headers = { 'content-type' : 'application/octet-stream' } ;
380
- var res = request . post ( buildUrl ( path ) , { body : reqBody , headers : headers } ) ;
380
+ var res = request . post ( buildUrl ( path ) , { body : reqBody , headers : headers , timeout : 300 } ) ;
381
381
expect ( res ) . to . be . a ( request . Response ) ;
382
382
var obj = JSON . parse ( res . body ) ;
383
383
expect ( obj . path ) . to . equal ( path ) ;
@@ -387,7 +387,7 @@ function RequestSuite () {
387
387
388
388
testBufferResponse : function ( ) {
389
389
var path = '/_admin/aardvark/favicon.ico' ;
390
- var res = request . get ( buildUrl ( path , false ) , { encoding : null } ) ;
390
+ var res = request . get ( buildUrl ( path , false ) , { encoding : null , timeout : 300 } ) ;
391
391
expect ( res ) . to . be . a ( request . Response ) ;
392
392
expect ( res . body ) . to . be . a ( Buffer ) ;
393
393
}
0 commit comments