mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
Get ghttp a chance to add custom host.
This commit is contained in:
@ -186,6 +186,10 @@ func (c *Client) DoRequest(method, url string, data ...interface{}) (resp *Clien
|
||||
// Custom header.
|
||||
if len(c.header) > 0 {
|
||||
for k, v := range c.header {
|
||||
// Set host by req.Host.
|
||||
if strings.ToLower(k) == "host" {
|
||||
req.Host = v
|
||||
}
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user