func Download()

in pkg/download/downloader.go [39:54]


func Download(d Downloader) (io.ReadCloser, error) {
	req, err := d.GetRequest()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to create the request")
	}

	resp, err := httpClient.Do(req)
	if err != nil {
		return nil, errors.Wrapf(err, "http request failed")
	}

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("unexpected status code: got=%d expected=%d", resp.StatusCode, http.StatusOK)
	}
	return resp.Body, nil
}