use http.Method

This commit is contained in:
Michael Yang
2023-11-02 13:10:58 -07:00
parent 2e53704685
commit 60bb3c03a1
5 changed files with 10 additions and 10 deletions

View File

@@ -89,7 +89,7 @@ func (b *blobDownload) Prepare(ctx context.Context, requestURL *url.URL, opts *R
}
if len(b.Parts) == 0 {
resp, err := makeRequest(ctx, "HEAD", requestURL, nil, nil, opts)
resp, err := makeRequest(ctx, http.MethodHead, requestURL, nil, nil, opts)
if err != nil {
return err
}
@@ -199,7 +199,7 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *Regis
func (b *blobDownload) downloadChunk(ctx context.Context, requestURL *url.URL, w io.Writer, part *blobDownloadPart, opts *RegistryOptions) error {
headers := make(http.Header)
headers.Set("Range", fmt.Sprintf("bytes=%d-%d", part.StartsAt(), part.StopsAt()-1))
resp, err := makeRequest(ctx, "GET", requestURL, headers, nil, opts)
resp, err := makeRequest(ctx, http.MethodGet, requestURL, headers, nil, opts)
if err != nil {
return err
}