Skip to content

Commit 5abb621

Browse files
steizaMDr164
authored andcommitted
Add the ability to customize the HTTP user agent
To help with things like sigstore/sigstore-go#143 Signed-off-by: Zach Steindler <[email protected]>
1 parent f1d8916 commit 5abb621

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

metadata/fetcher/fetcher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ type DefaultFetcher struct {
3737
httpUserAgent string
3838
}
3939

40+
func (d *DefaultFetcher) SetHTTPUserAgent(httpUserAgent string) {
41+
d.httpUserAgent = httpUserAgent
42+
}
43+
4044
// DownloadFile downloads a file from urlPath, errors out if it failed,
4145
// its length is larger than maxLength or the timeout is reached.
4246
func (d *DefaultFetcher) DownloadFile(urlPath string, maxLength int64, timeout time.Duration) ([]byte, error) {

0 commit comments

Comments
 (0)