卡密,直充,Request调整
This commit is contained in:
parent
50ab391039
commit
85034cfb35
|
@ -159,9 +159,7 @@ func (c *DctWServer) Request(_ context.Context, request DctWRequest, path string
|
|||
}
|
||||
signStr := c.Sign(string(body), path, timestamp)
|
||||
url := fmt.Sprintf("%s%s", c.Config.BaseUri, path)
|
||||
httpClient := &http.Client{
|
||||
Timeout: 15 * time.Second,
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", url, bytes.NewBuffer(body))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -170,13 +168,13 @@ func (c *DctWServer) Request(_ context.Context, request DctWRequest, path string
|
|||
req.Header = c.Headers(signStr, timestamp)
|
||||
|
||||
if c.DeBug {
|
||||
fmt.Printf("url:%s\n", url)
|
||||
fmt.Printf("body:%s\n", string(body))
|
||||
fmt.Printf("signStr:%s\n", signStr)
|
||||
fmt.Printf("Headers:%+v\n", req.Header)
|
||||
fmt.Printf("request.url:%s\n", url)
|
||||
fmt.Printf("request.body:%s\n", string(body))
|
||||
fmt.Printf("request.signStr:%s\n", signStr)
|
||||
fmt.Printf("request.headers:%+v\n", req.Header)
|
||||
}
|
||||
|
||||
resp, err := httpClient.Do(req)
|
||||
resp, err := c.HttpClient.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -187,7 +185,8 @@ func (c *DctWServer) Request(_ context.Context, request DctWRequest, path string
|
|||
}
|
||||
if c.DeBug {
|
||||
fmt.Printf("resp.Status:%s\n", resp.Status)
|
||||
fmt.Printf("bodyStr:%s\n", string(bodyBytes))
|
||||
fmt.Printf("resp.body:%s\n", string(bodyBytes))
|
||||
fmt.Printf("resp.headers:%+v\n", resp.Header)
|
||||
}
|
||||
|
||||
return bodyBytes, nil
|
||||
|
|
Loading…
Reference in New Issue