@@ -15,7 +15,6 @@ import (
15
15
"io"
16
16
"io/ioutil"
17
17
"net/http"
18
- "net/url"
19
18
"strings"
20
19
"time"
21
20
@@ -42,19 +41,14 @@ type VersionInfo struct {
42
41
Time time.Time
43
42
}
44
43
45
- // New constructs a *Client using the provided rawurl , which is expected to
44
+ // New constructs a *Client using the provided url , which is expected to
46
45
// be an absolute URI that can be directly passed to http.Get.
47
- func New (rawurl string ) (_ * Client , err error ) {
48
- defer derrors .Wrap (& err , "proxy.New(%q)" , rawurl )
49
- url , err := url .Parse (rawurl )
50
- if err != nil {
51
- return nil , fmt .Errorf ("url.Parse: %v" , err )
52
- }
53
- if url .Scheme != "https" {
54
- return nil , fmt .Errorf ("scheme must be https (got %s)" , url .Scheme )
55
- }
56
- cleanURL := strings .TrimRight (rawurl , "/" )
57
- return & Client {url : cleanURL , httpClient : & http.Client {Transport : & ochttp.Transport {}}}, nil
46
+ func New (u string ) (_ * Client , err error ) {
47
+ defer derrors .Wrap (& err , "proxy.New(%q)" , u )
48
+ return & Client {
49
+ url : strings .TrimRight (u , "/" ),
50
+ httpClient : & http.Client {Transport : & ochttp.Transport {}},
51
+ }, nil
58
52
}
59
53
60
54
// GetInfo makes a request to $GOPROXY/<module>/@v/<requestedVersion>.info and
0 commit comments