mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 05:07:44 +08:00
commit
13248d6736
@ -251,6 +251,10 @@ func (c *Client) prepareRequest(method, url string, data ...interface{}) (req *h
|
|||||||
} else {
|
} else {
|
||||||
req = req.WithContext(context.Background())
|
req = req.WithContext(context.Background())
|
||||||
}
|
}
|
||||||
|
// Client agent.
|
||||||
|
if c.agent != "" {
|
||||||
|
req.Header.Set("User-Agent", c.agent)
|
||||||
|
}
|
||||||
// Custom header.
|
// Custom header.
|
||||||
if len(c.header) > 0 {
|
if len(c.header) > 0 {
|
||||||
for k, v := range c.header {
|
for k, v := range c.header {
|
||||||
@ -279,10 +283,6 @@ func (c *Client) prepareRequest(method, url string, data ...interface{}) (req *h
|
|||||||
if len(c.authUser) > 0 {
|
if len(c.authUser) > 0 {
|
||||||
req.SetBasicAuth(c.authUser, c.authPass)
|
req.SetBasicAuth(c.authUser, c.authPass)
|
||||||
}
|
}
|
||||||
// Client agent.
|
|
||||||
if c.agent != "" {
|
|
||||||
req.Header.Set("User-Agent", c.agent)
|
|
||||||
}
|
|
||||||
return req, nil
|
return req, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user