Get ghttp a chance to add custom host.

This commit is contained in:
yqiangli
2020-03-31 21:50:15 +08:00
parent 992522342c
commit 8ab44dcb44

View File

@ -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)
}
}