@@ -1081,6 +1081,8 @@ https://github.com/Tencent/APIJSON/issues
1081
1081
scriptType : 'case' ,
1082
1082
scriptBelongId : 0 ,
1083
1083
scripts : newDefaultScript ( ) ,
1084
+ wait : 0 , // 每个请求前的等待延迟
1085
+ timeout : null , // 每个请求的超时时间
1084
1086
loadingCount : 0 ,
1085
1087
isPreScript : true ,
1086
1088
isRandomTest : false ,
@@ -6378,7 +6380,7 @@ https://github.com/Tencent/APIJSON/issues
6378
6380
var projectHosts = this . projectHosts || [ ]
6379
6381
var projectHost = this . projectHost || { }
6380
6382
var find = false
6381
- for ( var j = 0 ; j < projects . length ; j ++ ) {
6383
+ for ( var j = 0 ; j < projectHosts . length ; j ++ ) {
6382
6384
var pjt = projectHosts [ j ]
6383
6385
if ( pjt == null || StringUtil . isEmpty ( pjt . host , true ) ) {
6384
6386
continue
@@ -6393,7 +6395,7 @@ https://github.com/Tencent/APIJSON/issues
6393
6395
if ( find != true ) {
6394
6396
projectHosts . push ( { host : bu , project : projectHost . project } )
6395
6397
this . projectHosts = projectHosts
6396
- this . saveCache ( '' , 'projectHosts' , projects )
6398
+ this . saveCache ( '' , 'projectHosts' , projectHosts )
6397
6399
}
6398
6400
6399
6401
}
@@ -6425,7 +6427,7 @@ https://github.com/Tencent/APIJSON/issues
6425
6427
} ,
6426
6428
6427
6429
//请求
6428
- request : function ( isAdminOperation , method , type , url , req , header , callback , caseScript_ , accountScript_ , globalScript_ , ignorePreScript ) {
6430
+ request : function ( isAdminOperation , method , type , url , req , header , callback , caseScript_ , accountScript_ , globalScript_ , ignorePreScript , timeout_ , wait_ ) {
6429
6431
this . loadingCount ++
6430
6432
6431
6433
const isEnvCompare = this . isEnvCompareEnabled
@@ -6434,6 +6436,8 @@ https://github.com/Tencent/APIJSON/issues
6434
6436
const globalScript = ( isAdminOperation ? null : ( globalScript_ != null ? globalScript_ : ( scripts . global || { } ) [ 0 ] ) ) || { }
6435
6437
const accountScript = ( isAdminOperation ? null : ( accountScript_ != null ? accountScript_ : ( scripts . account || { } ) [ this . getCurrentAccountId ( ) || 0 ] ) ) || { }
6436
6438
const caseScript = ( isAdminOperation ? null : caseScript_ ) || { }
6439
+ const timeout = timeout_ != null ? timeout_ : this . timeout
6440
+ const wait = wait_ != null ? wait_ : ( this . wait || 0 )
6437
6441
6438
6442
var evalPostScript = function ( ) { }
6439
6443
@@ -6486,6 +6490,7 @@ https://github.com/Tencent/APIJSON/issues
6486
6490
headers : header , //Accept-Encoding(HTTP Header 大小写不敏感,SpringBoot 接收后自动转小写)可能导致 Response 乱码
6487
6491
withCredentials : true , //Cookie 必须要 type == REQUEST_TYPE_JSON
6488
6492
// crossDomain: true
6493
+ timeout : timeout
6489
6494
} )
6490
6495
. then ( function ( res ) {
6491
6496
App . currentHttpResponse = res
@@ -6775,7 +6780,9 @@ https://github.com/Tencent/APIJSON/issues
6775
6780
return
6776
6781
}
6777
6782
6778
- sendRequest ( isAdminOperation , method , type , url , req , header , callback )
6783
+ setTimeout ( function ( ) {
6784
+ sendRequest ( isAdminOperation , method , type , url , req , header , callback )
6785
+ } , wait < 0 ? 0 : wait )
6779
6786
} ,
6780
6787
6781
6788
0 commit comments