Commit 95d4da98 authored by Brendan Burns's avatar Brendan Burns

Merge pull request #3093 from derekwaynecarr/more_client_updates

Follow-up review comments from 3066
parents 6aa57e15 652b7aa6
...@@ -162,7 +162,7 @@ func (c *testClient) ValidateCommon(t *testing.T, err error) { ...@@ -162,7 +162,7 @@ func (c *testClient) ValidateCommon(t *testing.T, err error) {
} }
} }
// buildResourcePath is a convenience function for knowing if a namespace should in a path param or not // buildResourcePath is a convenience function for knowing if a namespace should be in a path param or not
func buildResourcePath(namespace, resource string) string { func buildResourcePath(namespace, resource string) string {
if len(namespace) > 0 { if len(namespace) > 0 {
if NamespaceInPathFor(testapi.Version()) { if NamespaceInPathFor(testapi.Version()) {
...@@ -172,7 +172,7 @@ func buildResourcePath(namespace, resource string) string { ...@@ -172,7 +172,7 @@ func buildResourcePath(namespace, resource string) string {
return resource return resource
} }
// buildQueryValues is a convenience function for knowing if a namespace should go in a query param or not // buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not
func buildQueryValues(namespace string, query url.Values) url.Values { func buildQueryValues(namespace string, query url.Values) url.Values {
v := url.Values{} v := url.Values{}
if query != nil { if query != nil {
......
...@@ -96,8 +96,8 @@ type Request struct { ...@@ -96,8 +96,8 @@ type Request struct {
sync bool sync bool
timeout time.Duration timeout time.Duration
// flag to control how to use namespace in urls // If true, put ns/<namespace> in path; if false, add "?namespace=<namespace>" as a query parameter
namespaceAsPath bool namespaceInPath bool
// output // output
err error err error
...@@ -105,13 +105,13 @@ type Request struct { ...@@ -105,13 +105,13 @@ type Request struct {
} }
// NewRequest creates a new request with the core attributes. // NewRequest creates a new request with the core attributes.
func NewRequest(client HTTPClient, verb string, baseURL *url.URL, codec runtime.Codec, namespaceAsPath bool) *Request { func NewRequest(client HTTPClient, verb string, baseURL *url.URL, codec runtime.Codec, namespaceInPath bool) *Request {
return &Request{ return &Request{
client: client, client: client,
verb: verb, verb: verb,
baseURL: baseURL, baseURL: baseURL,
codec: codec, codec: codec,
namespaceAsPath: namespaceAsPath, namespaceInPath: namespaceInPath,
path: baseURL.Path, path: baseURL.Path,
} }
} }
...@@ -141,7 +141,7 @@ func (r *Request) Namespace(namespace string) *Request { ...@@ -141,7 +141,7 @@ func (r *Request) Namespace(namespace string) *Request {
} }
if len(namespace) > 0 { if len(namespace) > 0 {
if r.namespaceAsPath { if r.namespaceInPath {
return r.Path("ns").Path(namespace) return r.Path("ns").Path(namespace)
} else { } else {
return r.setParam("namespace", namespace) return r.setParam("namespace", namespace)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment