完成响应数据填充
This commit is contained in:
@ -24,6 +24,7 @@ type Request struct {
|
||||
DataField string `json:"data_field"` // 数据字段
|
||||
CodeField string `json:"code_field"` // 业务状态码字段
|
||||
MessageField string `json:"message_field"` // code描述字段
|
||||
DataReceiver interface{} `json:"-"` // 响应data部分数据解析
|
||||
SuccessCodeList []string `json:"success_code_list"` // 哪些业务状态码视为成功
|
||||
ConnectTimeout int64 `json:"connect_timeout"` // 连接超时时间: ms
|
||||
ReadTimeout int64 `json:"read_timeout"` // 读取超时时间
|
||||
|
@ -19,10 +19,11 @@ import (
|
||||
type Response struct {
|
||||
Header map[string]string `json:"header"` // 响应header
|
||||
Cookie map[string]string `json:"cookie"` // 响应cookie
|
||||
Body map[string]any `json:"body"` // 响应body
|
||||
Data string `json:"data"` // 响应body
|
||||
Code string `json:"code"` // 业务状态码
|
||||
Message string `json:"message"` // 业务状态码描述
|
||||
Data string `json:"data"` // 响应数据
|
||||
Body string `json:"body"` // 响应数据
|
||||
ExtendData map[string]string `json:"extend_data"` // 除去 code / message / data 之外的其他数据
|
||||
HttpCode int `json:"http_code"` // http状态码
|
||||
HttpCodeStatus string `json:"http_code_status"` // http状态码描述
|
||||
ResponseDataRule map[string]any `json:"response_data_rule"` // 返回数据的验证规则
|
||||
@ -33,7 +34,7 @@ type Response struct {
|
||||
RestyResponse *resty.Response `json:"-"` // 请求返回
|
||||
IsSuccess bool `json:"is_success"` // 是否请求成功
|
||||
RequestCount int `json:"request_count"` // 请求次数
|
||||
FailInfo *ResponseFileInfo `json:"fail_info"` // 请求失败信息记录
|
||||
FailInfo *ResponseFailInfo `json:"fail_info"` // 请求失败信息记录
|
||||
IsCache bool `json:"-"` // 是否命中缓存
|
||||
CacheKey string `json:"-"` // 缓存key
|
||||
CacheValue string `json:"-"` // 缓存值
|
||||
@ -41,12 +42,12 @@ type Response struct {
|
||||
CacheError error `json:"-"` // 缓存是否异常
|
||||
}
|
||||
|
||||
// ResponseFileInfo 失败信息
|
||||
// ResponseFailInfo 失败信息
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:48 2024/6/1
|
||||
type ResponseFileInfo struct {
|
||||
type ResponseFailInfo struct {
|
||||
Type string `json:"type"` // 失败类型
|
||||
Message string `json:"message"` // 失败信息
|
||||
}
|
||||
|
Reference in New Issue
Block a user