Skip to content

Commit

Permalink
Use a HEAD instead of GET
Browse files Browse the repository at this point in the history
... to retrieve only the headers of the resource without the body. This will save bandwidth and time.

Signed-off-by: Volker Theile <vtheile@suse.com>
  • Loading branch information
votdev committed Feb 8, 2024
1 parent b3275a8 commit e503e55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sync/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (h *HTTPHandler) GetSizeFromURL(url string) (size int64, err error) {
ctx, cancel := context.WithTimeout(context.Background(), types.HTTPTimeout)
defer cancel()

rr, err := http.NewRequestWithContext(ctx, "GET", url, nil)
rr, err := http.NewRequestWithContext(ctx, http.MethodHead, url, nil)
if err != nil {
return 0, err
}
Expand Down

0 comments on commit e503e55

Please sign in to comment.