完成部分重试&异常结果类型判断逻辑
This commit is contained in:
@ -27,17 +27,18 @@ type APIMethod struct {
|
||||
//
|
||||
// Date : 8:32 下午 2021/8/1
|
||||
type ResponseConfig struct {
|
||||
RetryRule int `json:"retry_rule"` // 重试规则 0 - http error 1 - business error 2 - both 0 && 1
|
||||
RetryCnt int `json:"retry_cnt"` // 重试次数(重试次数 1, 最多请求两次)
|
||||
RetryInterval int `json:"retry_interval"` // 重试的时间间隔, 单位ms, 为 0 立即重试, > 0 休眠指定ms后重试
|
||||
ISJson bool `json:"is_json"` // 响应数据是否为json
|
||||
CodeKey string `json:"code_key"` // 代表业务Code的Key
|
||||
MessageKey string `json:"message_key"` // 描述业务code的key
|
||||
TraceKey string `json:"trace_key"` // 接口返回的trace追踪字段key
|
||||
DataKey string `json:"data_key"` // 返回数据的key
|
||||
CostKey string `json:"cost_key"` // 代表接口耗时的key
|
||||
SuccessRule string `json:"success_rule"` // 请求成功的规则, http_code / business_code http状态码或者业务状态码, 如果是通过http code 判断是否为请求成功 code key / message key 配置无效
|
||||
SuccessCode []string `json:"success_code"` // 哪些状态码被认为是请求成功
|
||||
RetryRule int `json:"retry_rule"` // 重试规则 0 - http error 1 - business error 2 - both 0 && 1
|
||||
RetryCnt int `json:"retry_cnt"` // 重试次数(重试次数 1, 最多请求两次)
|
||||
RetryInterval int `json:"retry_interval"` // 重试的时间间隔, 单位ms, 为 0 立即重试, > 0 休眠指定ms后重试
|
||||
ISJson bool `json:"is_json"` // 响应数据是否为json
|
||||
CodeKey string `json:"code_key"` // 代表业务Code的Key
|
||||
MessageKey string `json:"message_key"` // 描述业务code的key
|
||||
TraceKey string `json:"trace_key"` // 接口返回的trace追踪字段key
|
||||
DataKey string `json:"data_key"` // 返回数据的key
|
||||
CostKey string `json:"cost_key"` // 代表接口耗时的key
|
||||
SuccessRule string `json:"success_rule"` // 请求成功的规则, http_code / business_code http状态码或者业务状态码, 如果是通过http code 判断是否为请求成功 code key / message key 配置无效
|
||||
SuccessCode []string `json:"success_code"` // 哪些状态码被认为是请求成功
|
||||
SuccessHttpCode []string `json:"success_http_code"` // 被认为是成功的http code
|
||||
}
|
||||
|
||||
// APIResponse API响应数据
|
||||
|
Reference in New Issue
Block a user