添加测试

This commit is contained in:
Yun
2023-09-01 22:02:24 +08:00
parent 109a67a688
commit 7d8ea7458f
3 changed files with 21 additions and 8 deletions
+3 -3
View File
@@ -42,7 +42,6 @@ type CurlParams struct {
Headers map[string]interface{}
Cookies interface{}
DataType dataType // FORM,JSON,XML
timeOutSecond int
}
var (
@@ -76,12 +75,13 @@ type DialContext func(ctx context.Context, network, addr string) (net.Conn, erro
type curlx struct {
transport *http.Transport
timeOutSecond int
}
func NewCurlx() *curlx {
return &curlx{
transport: &transport,
timeOutSecond: 60
timeOutSecond: 180,
}
}
@@ -165,7 +165,7 @@ func (c *curlx) Send(ctx context.Context, p *CurlParams) (res string, httpcode i
*/
func (c *curlx) sendExec(ctx context.Context, p *CurlParams) (resp *http.Response, err error) {
client := &http.Client{
Timeout: time.Second * time.Duration(p.timeOutSecond), // 设置该条连接的超时
Timeout: time.Second * time.Duration(c.timeOutSecond), // 设置该条连接的超时
Transport: c.transport, //
}