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