Skip to content

Commit 111eb7d

Browse files
committed
Add user agent for rest calls
1 parent a03921c commit 111eb7d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

azure-devops-client/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ func (c *AzureDevopsClient) SetRetries(v int) {
6868
}
6969
}
7070

71+
func (c *AzureDevopsClient) SetUserAgent(v string) {
72+
c.rest().SetHeader("User-Agent", v)
73+
}
74+
7175
func (c *AzureDevopsClient) SetApiVersion(apiversion string) {
7276
c.ApiVersion = apiversion
7377
}
78+
7479
func (c *AzureDevopsClient) SetOrganization(url string) {
7580
c.organization = &url
7681
}

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func initAzureConnection() {
172172
AzureDevopsClient.SetApiVersion(opts.AzureDevopsApiVersion)
173173
AzureDevopsClient.SetConcurrency(opts.RequestConcurrencyLimit)
174174
AzureDevopsClient.SetRetries(opts.RequestRetries)
175+
AzureDevopsClient.SetUserAgent(fmt.Sprintf("azure-devops-exporter/%v", Version))
175176

176177
AzureDevopsClient.LimitBuildsPerDefinition = opts.LimitBuildsPerDefinition
177178
AzureDevopsClient.LimitReleasesPerDefinition = opts.LimitReleasesPerDefinition

0 commit comments

Comments
 (0)