From 652b7aa6653daaf8cb3d4dcc1716138c74e03515 Mon Sep 17 00:00:00 2001 From: derekwaynecarr Date: Mon, 22 Dec 2014 11:41:17 -0500 Subject: [PATCH] Rename namespaceAsPath --- pkg/client/client_test.go | 4 ++-- pkg/client/request.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index e4a4b9c6f39..b6180fc17ae 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -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 { if len(namespace) > 0 { if NamespaceInPathFor(testapi.Version()) { @@ -172,7 +172,7 @@ func buildResourcePath(namespace, resource string) string { 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 { v := url.Values{} if query != nil { diff --git a/pkg/client/request.go b/pkg/client/request.go index e0becc34357..0a4698c92ee 100644 --- a/pkg/client/request.go +++ b/pkg/client/request.go @@ -96,8 +96,8 @@ type Request struct { sync bool timeout time.Duration - // flag to control how to use namespace in urls - namespaceAsPath bool + // If true, put ns/ in path; if false, add "?namespace=" as a query parameter + namespaceInPath bool // output err error @@ -105,13 +105,13 @@ type Request struct { } // 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{ client: client, verb: verb, baseURL: baseURL, codec: codec, - namespaceAsPath: namespaceAsPath, + namespaceInPath: namespaceInPath, path: baseURL.Path, } } @@ -141,7 +141,7 @@ func (r *Request) Namespace(namespace string) *Request { } if len(namespace) > 0 { - if r.namespaceAsPath { + if r.namespaceInPath { return r.Path("ns").Path(namespace) } else { return r.setParam("namespace", namespace)