fetch retrieves the package using the given scheme and returns the response and a string of the URL of the fetch.
(scheme, packageName string, verbose bool)
| 115 | |
| 116 | // fetch retrieves the package using the given scheme and returns the response and a string of the URL of the fetch. |
| 117 | func fetch(scheme, packageName string, verbose bool) (string, *http.Response, error) { |
| 118 | u, err := url.Parse(scheme + "://" + packageName) |
| 119 | if err != nil { |
| 120 | return "", nil, err |
| 121 | } |
| 122 | u.RawQuery = DiscoveryQueryParam |
| 123 | urlStr := u.String() |
| 124 | if verbose { |
| 125 | fmt.Fprintf(config.Out, "fetching %s", urlStr) |
| 126 | } |
| 127 | |
| 128 | res, err := httpClient.Get(urlStr) |
| 129 | return urlStr, res, err |
| 130 | } |
| 131 | |
| 132 | // parseSpreadRefs reads an HTML document from r and uses it to return information about the package. |
| 133 | // Information is currently stored in a <meta> tag with the name "spread-ref". Based on Go Get parsing code. |
no test coverage detected