Skip to content

Commit

Permalink
Merge pull request kubernetes#3093 from derekwaynecarr/more_client_up…
Browse files Browse the repository at this point in the history
…dates

Follow-up review comments from 3066
  • Loading branch information
brendandburns committed Dec 22, 2014
2 parents 6aa57e1 + 652b7aa commit 95d4da9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions pkg/client/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,22 @@ type Request struct {
sync bool
timeout time.Duration

// flag to control how to use namespace in urls
namespaceAsPath bool
// If true, put ns/<namespace> in path; if false, add "?namespace=<namespace>" as a query parameter
namespaceInPath bool

// output
err error
body io.Reader
}

// 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,
}
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 95d4da9

Please sign in to comment.