Skip to content

Commit

Permalink
solving logical bug with input without port
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 committed Oct 11, 2020
1 parent 695c2a2 commit 500d7bb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions v2/pkg/requests/bulk-http-request.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,13 @@ func setHeader(req *http.Request, name, value string) {
// the template port and path preference
func baseURLWithTemplatePrefs(data string, parsedURL *url.URL) string {
// template port preference over input URL port
// template has port
hasPort := len(urlWithPortRgx.FindStringSubmatch(data)) > 0
if hasPort {
hostname, _, _ := net.SplitHostPort(parsedURL.Host)
parsedURL.Host = hostname
// check if also the input contains port, in this case extracts the url
if hostname, _, err := net.SplitHostPort(parsedURL.Host); err == nil {
parsedURL.Host = hostname
}
}

return parsedURL.String()
Expand Down

0 comments on commit 500d7bb

Please sign in to comment.