Skip to content

Commit 93e9592

Browse files
committed
Add useragent header
1 parent ad14283 commit 93e9592

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cmd/preflight/cli/run_nocrd.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ func runPreflightsNoCRD(v *viper.Viper, arg string) error {
4444

4545
preflightContent = string(b)
4646
} else {
47-
resp, err := http.Get(arg)
47+
req, err := http.NewRequest("GET", arg, nil)
48+
if err != nil {
49+
return err
50+
}
51+
req.Header.Set("User-Agent", "Replicated_Preflight/v1beta1")
52+
resp, err := http.DefaultClient.Do(req)
4853
if err != nil {
4954
return err
5055
}

cmd/troubleshoot/cli/run_nocrd.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ func runTroubleshootNoCRD(v *viper.Viper, arg string) error {
4343

4444
collectorContent = string(b)
4545
} else {
46-
resp, err := http.Get(arg)
46+
req, err := http.NewRequest("GET", arg, nil)
47+
if err != nil {
48+
return err
49+
}
50+
req.Header.Set("User-Agent", "Replicated_Troubleshoot/v1beta1")
51+
resp, err := http.DefaultClient.Do(req)
4752
if err != nil {
4853
return err
4954
}

0 commit comments

Comments
 (0)