Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
3ee50ccf
Unverified
Commit
3ee50ccf
authored
Nov 20, 2017
by
Matthew Fisher
Committed by
GitHub
Nov 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3174 from mattfarina/feat/user-agent
feat(http): Add a Helm user-agent string to the http getter
parents
d790f7d8
275fbd43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
httpgetter.go
pkg/getter/httpgetter.go
+11
-1
No files found.
pkg/getter/httpgetter.go
View file @
3ee50ccf
...
...
@@ -20,9 +20,11 @@ import (
"fmt"
"io"
"net/http"
"strings"
"k8s.io/helm/pkg/tlsutil"
"k8s.io/helm/pkg/urlutil"
"k8s.io/helm/pkg/version"
)
//httpGetter is the efault HTTP(/S) backend handler
...
...
@@ -34,7 +36,15 @@ type httpGetter struct {
func
(
g
*
httpGetter
)
Get
(
href
string
)
(
*
bytes
.
Buffer
,
error
)
{
buf
:=
bytes
.
NewBuffer
(
nil
)
resp
,
err
:=
g
.
client
.
Get
(
href
)
// Set a helm specific user agent so that a repo server and metrics can
// separate helm calls from other tools interacting with repos.
req
,
err
:=
http
.
NewRequest
(
"GET"
,
href
,
nil
)
if
err
!=
nil
{
return
buf
,
err
}
req
.
Header
.
Set
(
"User-Agent"
,
"Helm/"
+
strings
.
TrimPrefix
(
version
.
GetVersion
(),
"v"
))
resp
,
err
:=
g
.
client
.
Do
(
req
)
if
err
!=
nil
{
return
buf
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment