Skip to content

Commit

Permalink
Merge pull request #239 from tufanbarisyildirim/feature/passing-host-…
Browse files Browse the repository at this point in the history
…header

a workaround for golang limitation of passing Host in header
  • Loading branch information
hunterlong committed Sep 4, 2019
2 parents a19b5dc + 4f86749 commit 23b6c39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/utils.go
Expand Up @@ -301,7 +301,11 @@ func HttpRequest(url, method string, content interface{}, headers []string, body
keyVal := strings.Split(h, "=")
if len(keyVal) == 2 {
if keyVal[0] != "" && keyVal[1] != "" {
req.Header.Set(keyVal[0], keyVal[1])
if strings.ToLower(keyVal[0]) == "host" {
req.Host = strings.TrimSpace(keyVal[1])
} else {
req.Header.Set(keyVal[0], keyVal[1])
}
}
}
}
Expand Down

0 comments on commit 23b6c39

Please sign in to comment.