aboutsummaryrefslogtreecommitdiff
path: root/go/util
diff options
context:
space:
mode:
Diffstat (limited to 'go/util')
-rw-r--r--go/util/http_util.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/go/util/http_util.go b/go/util/http_util.go
index 52579d746..e2391887e 100644
--- a/go/util/http_util.go
+++ b/go/util/http_util.go
@@ -104,3 +104,10 @@ func DownloadUrl(fileUrl string) (filename string, content []byte, e error) {
func Do(req *http.Request) (resp *http.Response, err error) {
return client.Do(req)
}
+
+func NormalizeUrl(url string) string {
+ if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
+ return url
+ }
+ return "http://" + url
+}