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