You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/09/15 20:52:53 UTC
[incubator-openwhisk-client-go] branch master updated: CLI User
Agent Header (#2591)
This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git
The following commit(s) were added to refs/heads/master by this push:
new d9d11f0 CLI User Agent Header (#2591)
d9d11f0 is described below
commit d9d11f0b21f8c32b3d78cd632d41a69a818be200
Author: David Cariello <dr...@us.ibm.com>
AuthorDate: Thu Sep 7 22:33:17 2017 -0500
CLI User Agent Header (#2591)
---
whisk/api.go | 3 +--
whisk/client.go | 9 +++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/whisk/api.go b/whisk/api.go
index 0d318d2..4a30118 100644
--- a/whisk/api.go
+++ b/whisk/api.go
@@ -45,7 +45,6 @@ type ApiListRequestOptions struct {
Skip int `url:"skip"`
Docs bool `url:"docs,omitempty"`
}
-//type ApiListResponse RetApiArray
type ApiListResponse RetApiArray
// wsk api get : Request, Response
@@ -105,7 +104,7 @@ type RetApiArray struct {
type ApiItem struct {
ApiId string `json:"id,omitempty"`
QueryKey string `json:"key,omitempty"`
- ApiValue *RetApi `json:"value,omitempty"`
+ ApiValue *RetApi `json:"value,omitempty"`
}
type RetApi struct {
diff --git a/whisk/client.go b/whisk/client.go
index c8cb311..5fe0b14 100644
--- a/whisk/client.go
+++ b/whisk/client.go
@@ -77,6 +77,7 @@ type Config struct {
Verbose bool
Debug bool // For detailed tracing
Insecure bool
+ UserAgent string
}
func NewClient(httpClient *http.Client, config_input *Config) (*Client, error) {
@@ -147,6 +148,10 @@ func NewClient(httpClient *http.Client, config_input *Config) (*Client, error) {
config.Version = "v1"
}
+ if len(config.UserAgent) == 0 {
+ config.UserAgent = "OpenWhisk-Go-Client"
+ }
+
c := &Client{
client: httpClient,
Config: config,
@@ -225,6 +230,8 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}, includeName
return nil, werr
}
+ req.Header.Add("User-Agent", c.Config.UserAgent)
+
return req, nil
}
@@ -673,5 +680,7 @@ func (c *Client) NewRequestUrl(
Debug(DbgInfo, "No auth header required\n")
}
+ req.Header.Add("User-Agent", c.Config.UserAgent)
+
return req, nil
}
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].