添加测试
This commit is contained in:
@@ -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, //
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user