Skip to content
Permalink
Browse files

Merge pull request #239 from tufanbarisyildirim/feature/passing-host-…

…header

a workaround for golang limitation of passing Host in header
  • Loading branch information...
hunterlong committed Sep 4, 2019
2 parents a19b5dc + 4f86749 commit 23b6c3962369f9c4348987662b3649644dd84034
Showing with 5 additions and 1 deletion.
  1. +5 −1 utils/utils.go
@@ -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])
}
}
}
}

0 comments on commit 23b6c39

Please sign in to comment.
You can’t perform that action at this time.