修复HTTPClient超时不反回问题,并提供设置超时时间接口

This commit is contained in:
lifeiyi
2020-09-17 17:18:52 +08:00
parent e83d9ee4ed
commit 7b24350c7d

View File

@@ -64,9 +64,14 @@ func (slf *HttpClientModule) Init(maxpool int, proxyUrl string) {
Proxy: proxyfun,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
Timeout: 5 * time.Second,
}
}
func (slf *HttpClientModule) SetTimeOut(value time.Duration) {
slf.client.Timeout = value
}
func (slf *HttpClientModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
ret := SyncHttpRespone{
resp: make(chan HttpRespone, 1),