fix: set the client user agent
The code already existed for setting the UserAgent header, but a value was never passed to the client. This change will now set a string matching the following format ``` faas-cli/<build version> ``` For example: ``` faas-cli/0.14.6-5-ga9c2b10f ``` Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
81ea36ae7d
commit
29953f1836
@@ -11,6 +11,8 @@ import (
|
||||
gopath "path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/openfaas/faas-cli/version"
|
||||
)
|
||||
|
||||
// Client an API client to perform all operations
|
||||
@@ -51,6 +53,7 @@ func NewClient(auth ClientAuth, gatewayURL string, transport http.RoundTripper,
|
||||
ClientAuth: auth,
|
||||
httpClient: client,
|
||||
GatewayURL: baseURL,
|
||||
UserAgent: fmt.Sprintf("faas-cli/%s", version.BuildVersion()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package version
|
||||
|
||||
const UserAgent = "OpenFaaS CLI"
|
||||
|
||||
var (
|
||||
Version, GitCommit string
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user