mirror of https://github.com/statping/statping
Merge pull request #239 from tufanbarisyildirim/feature/passing-host-header
a workaround for golang limitation of passing Host in headerpull/251/head
commit
23b6c39623
|
@ -301,10 +301,14 @@ func HttpRequest(url, method string, content interface{}, headers []string, body
|
|||
keyVal := strings.Split(h, "=")
|
||||
if len(keyVal) == 2 {
|
||||
if keyVal[0] != "" && keyVal[1] != "" {
|
||||
if strings.ToLower(keyVal[0]) == "host" {
|
||||
req.Host = strings.TrimSpace(keyVal[1])
|
||||
} else {
|
||||
req.Header.Set(keyVal[0], keyVal[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var resp *http.Response
|
||||
if resp, err = client.Do(req); err != nil {
|
||||
return nil, resp, err
|
||||
|
|
Loading…
Reference in New Issue