Tweaks based on review comments

Signed-off-by: Michael Kelly <mkelly@arista.com>
This commit is contained in:
Michael Kelly 2022-06-07 20:41:35 -07:00
parent 6c99a9b99d
commit a51d12056f
No known key found for this signature in database
GPG key ID: 77F7FE93040ECF3E
2 changed files with 9 additions and 9 deletions

View file

@ -96,18 +96,18 @@ func (cli *client) urlForWithParams(
} else { } else {
p = path.Join(basePath, apiVersion, resource, name) p = path.Join(basePath, apiVersion, resource, name)
} }
if strings.HasSuffix(cli.baseURL, "/") {
return cli.baseURL + p
}
r := cli.baseURL + "/" + p
encodedParams := params.Encode() encodedParams := params.Encode()
paramsSuffix := ""
if len(encodedParams) > 0 { if len(encodedParams) > 0 {
return r + "?" + encodedParams paramsSuffix = "?" + encodedParams
} }
return r if strings.HasSuffix(cli.baseURL, "/") {
return cli.baseURL + p + paramsSuffix
}
return cli.baseURL + "/" + p + paramsSuffix
} }
func (cli *client) urlFor(apiVersion, namespace, resource, name string) string { func (cli *client) urlFor(apiVersion, namespace, resource, name string) string {
@ -201,7 +201,7 @@ func (cli *client) listN(resource string, v interface{}, n int) error {
} }
func (cli *client) list(resource string, v interface{}) error { func (cli *client) list(resource string, v interface{}) error {
return cli.listN(resource, v, -1) return cli.get(resource, "", v)
} }
func (cli *client) post(resource string, v interface{}) error { func (cli *client) post(resource string, v interface{}) error {

View file

@ -41,7 +41,7 @@ const (
) )
const ( const (
gcResultLimit = 10000 gcResultLimit = 500
) )
// Config values for the Kubernetes storage type. // Config values for the Kubernetes storage type.