From b57054bd0c68c580ef2a56c83fbeea1ac1afabda Mon Sep 17 00:00:00 2001 From: Denys Kashkovskyi Date: Fri, 15 Apr 2022 19:42:30 +0000 Subject: [PATCH] Properly utilize url scheme --- core/tester.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/tester.go b/core/tester.go index 5e41478..cac1401 100644 --- a/core/tester.go +++ b/core/tester.go @@ -6,6 +6,7 @@ import ( "net/url" "regexp" "strconv" + "strings" "time" ) @@ -75,7 +76,8 @@ func (t *Tester) tcp(url *url.URL) int { func (t *Tester) http(url *url.URL) (status string, duration time.Duration) { tp := NewTransport(t.requestTimeout) client := http.Client{Transport: tp, Timeout: t.requestTimeout} - res, err := client.Get("http://" + url.Host) + addr := strings.Replace(url.String(), "tcp", "http", 1) + res, err := client.Get(addr) duration = tp.Duration() if err == nil { status = res.Status