save code
This commit is contained in:
parent
f438b1e0ea
commit
bb4033d2dc
14
define.go
14
define.go
@ -11,10 +11,6 @@
|
||||
// Date: 2022/05/01 19:56:48
|
||||
package httpclient
|
||||
|
||||
import (
|
||||
"github.com/ddliu/go-httpclient"
|
||||
)
|
||||
|
||||
const (
|
||||
// ContentTypeFormData form-data 请求
|
||||
ContentTypeFormData = "form-data"
|
||||
@ -84,9 +80,9 @@ type Timeout struct {
|
||||
//
|
||||
// Date: 2022/05/01 20:25:39
|
||||
type ApiResponse struct {
|
||||
RequestConfig *ApiRequestConfig `json:"request_config"` // 请求配置
|
||||
Response *httpclient.Response `json:"response"` // 响应体
|
||||
Exception *Exception `json:"exception"` // 异常信息
|
||||
StartRequestTime int64 `json:"start_request_time"` // 开始请求时间, 纳秒
|
||||
FinishRequestTime int64 `json:"finish_request_time"` // 完成请求时间,纳秒
|
||||
RequestConfig *ApiRequestConfig `json:"request_config"` // 请求配置
|
||||
Response map[string]interface{} `json:"response"` // 响应体
|
||||
Exception *Exception `json:"exception"` // 异常信息
|
||||
StartRequestTime int64 `json:"start_request_time"` // 开始请求时间, 纳秒
|
||||
FinishRequestTime int64 `json:"finish_request_time"` // 完成请求时间,纳秒
|
||||
}
|
||||
|
@ -162,7 +162,9 @@ func getHttpClient(apiConfig *ApiRequestConfig, header map[string]string) *dataf
|
||||
apiConfig.ContentType = ContentTypeDefault
|
||||
}
|
||||
fullHeader["content-type"] = apiConfig.ContentType
|
||||
return gout.New().SetMethod(apiConfig.Method).SetHeader(header).SetTimeout(time.Second * time.Duration(apiConfig.Timeout.Connect+apiConfig.Timeout.Read))
|
||||
return gout.New().SetMethod(apiConfig.Method).
|
||||
SetHeader(header).
|
||||
SetTimeout(time.Second * time.Duration(apiConfig.Timeout.Connect+apiConfig.Timeout.Read))
|
||||
}
|
||||
|
||||
// buildRequestURLAndParam 构建完整请求URL与请求参数
|
||||
|
Loading…
Reference in New Issue
Block a user