Skip to content
Permalink
Browse files

a workaroung for golang limitation of passing Host in header

  • Loading branch information...
tufanbarisyildirim committed Sep 4, 2019
1 parent a19b5dc commit 4f86749b64d1f219c885f885584a0272faca0e1a
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 4f86749

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