Nomalize url before redirecting.

This commit is contained in:
chrislusf
2015-04-16 10:02:53 -07:00
parent 67146ffa78
commit 087b839354
3 changed files with 10 additions and 2 deletions

View File

@@ -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
}