Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
95d4da98
Commit
95d4da98
authored
Dec 22, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3093 from derekwaynecarr/more_client_updates
Follow-up review comments from 3066
parents
6aa57e15
652b7aa6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
client_test.go
pkg/client/client_test.go
+2
-2
request.go
pkg/client/request.go
+5
-5
No files found.
pkg/client/client_test.go
View file @
95d4da98
...
...
@@ -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
{
...
...
pkg/client/request.go
View file @
95d4da98
...
...
@@ -96,8 +96,8 @@ type Request struct {
sync
bool
timeout
time
.
Duration
//
flag to control how to use namespace in urls
namespace
As
Path
bool
//
If true, put ns/<namespace> in path; if false, add "?namespace=<namespace>" as a query parameter
namespace
In
Path
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
,
namespace
As
Path
bool
)
*
Request
{
func
NewRequest
(
client
HTTPClient
,
verb
string
,
baseURL
*
url
.
URL
,
codec
runtime
.
Codec
,
namespace
In
Path
bool
)
*
Request
{
return
&
Request
{
client
:
client
,
verb
:
verb
,
baseURL
:
baseURL
,
codec
:
codec
,
namespace
AsPath
:
namespaceAs
Path
,
namespace
InPath
:
namespaceIn
Path
,
path
:
baseURL
.
Path
,
}
}
...
...
@@ -141,7 +141,7 @@ func (r *Request) Namespace(namespace string) *Request {
}
if
len
(
namespace
)
>
0
{
if
r
.
namespace
As
Path
{
if
r
.
namespace
In
Path
{
return
r
.
Path
(
"ns"
)
.
Path
(
namespace
)
}
else
{
return
r
.
setParam
(
"namespace"
,
namespace
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment