feat: 改为复用 http client
This commit is contained in:
@@ -21,7 +21,7 @@ func Login(c *srunTransfer.Login) error {
|
||||
}
|
||||
return url + "://" + c.LoginInfo.Form.Domain + "/"
|
||||
}(),
|
||||
Transport: c.Transport,
|
||||
Client: c.Client,
|
||||
}
|
||||
|
||||
var ok bool
|
||||
|
||||
12
v1/steps.go
12
v1/steps.go
@@ -11,8 +11,8 @@ import (
|
||||
)
|
||||
|
||||
type SrunApi struct {
|
||||
BaseUrl string
|
||||
Transport *http.Transport
|
||||
BaseUrl string
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
func (a *SrunApi) request(path string, query map[string]interface{}) (map[string]interface{}, error) {
|
||||
@@ -24,11 +24,9 @@ func (a *SrunApi) request(path string, query map[string]interface{}) (map[string
|
||||
}
|
||||
query["callback"] = callback
|
||||
query["_"] = timestamp
|
||||
_, res, e := tool.HTTP.GetString(&tool.GetRequest{
|
||||
Url: a.BaseUrl + path,
|
||||
Query: query,
|
||||
Redirect: true,
|
||||
Transport: a.Transport,
|
||||
_, res, e := tool.NewHttpTool(a.Client).GetString(&tool.DoHttpReq{
|
||||
Url: a.BaseUrl + path,
|
||||
Query: query,
|
||||
})
|
||||
if e != nil {
|
||||
util.Log.Debug(e)
|
||||
|
||||
@@ -32,5 +32,5 @@ type Login struct {
|
||||
OutPut bool
|
||||
//登录参数,不可缺省
|
||||
LoginInfo LoginInfo
|
||||
Transport *http.Transport
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user