Better deal with failures under golang 1.8beta1

If there is any error in the initial parsing then we should just
try adding the scheme.

url.Parse(base) has changed in 1.8. Please see the following change
c5ccbdd22b

Fixes #38380
This commit is contained in:
Davanum Srinivas 2016-12-09 14:14:13 -05:00
parent 7168fce59a
commit bbd04cde41

View File

@ -33,10 +33,7 @@ func DefaultServerURL(host, apiPath string, groupVersion schema.GroupVersion, de
}
base := host
hostURL, err := url.Parse(base)
if err != nil {
return nil, "", err
}
if hostURL.Scheme == "" || hostURL.Host == "" {
if err != nil || hostURL.Scheme == "" || hostURL.Host == "" {
scheme := "http://"
if defaultTLS {
scheme = "https://"