Skip to content

Commit

Permalink
Add the ability to customize the HTTP user agent
Browse files Browse the repository at this point in the history
To help with things like sigstore/sigstore-go#143

Signed-off-by: Zach Steindler <[email protected]>
  • Loading branch information
steiza authored and MDr164 committed Jul 1, 2024
1 parent f1d8916 commit 5abb621
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions metadata/fetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ type DefaultFetcher struct {
httpUserAgent string
}

func (d *DefaultFetcher) SetHTTPUserAgent(httpUserAgent string) {
d.httpUserAgent = httpUserAgent
}

// DownloadFile downloads a file from urlPath, errors out if it failed,
// its length is larger than maxLength or the timeout is reached.
func (d *DefaultFetcher) DownloadFile(urlPath string, maxLength int64, timeout time.Duration) ([]byte, error) {
Expand Down

0 comments on commit 5abb621

Please sign in to comment.