MCPcopy
hub / github.com/kubernetes/client-go / URL

Method URL

rest/request.go:422–454  ·  view source on GitHub ↗

URL returns the current working URL.

()

Source from the content-addressed store, hash-verified

420
421// URL returns the current working URL.
422func (r *Request) URL() *url.URL {
423 p := r.pathPrefix
424 if r.namespaceSet && len(r.namespace) > 0 {
425 p = path.Join(p, "namespaces", r.namespace)
426 }
427 if len(r.resource) != 0 {
428 p = path.Join(p, strings.ToLower(r.resource))
429 }
430 // Join trims trailing slashes, so preserve r.pathPrefix's trailing slash for backwards compatibility if nothing was changed
431 if len(r.resourceName) != 0 || len(r.subpath) != 0 || len(r.subresource) != 0 {
432 p = path.Join(p, r.resourceName, r.subresource, r.subpath)
433 }
434
435 finalURL := &url.URL{}
436 if r.baseURL != nil {
437 *finalURL = *r.baseURL
438 }
439 finalURL.Path = p
440
441 query := url.Values{}
442 for key, values := range r.params {
443 for _, value := range values {
444 query.Add(key, value)
445 }
446 }
447
448 // timeout is handled specially here.
449 if r.timeout != 0 {
450 query.Set("timeout", r.timeout.String())
451 }
452 finalURL.RawQuery = query.Encode()
453 return finalURL
454}
455
456// finalURLTemplate is similar to URL(), but will make all specific parameter values equal
457// - instead of name or namespace, "{name}" and "{namespace}" will be used, and all query

Callers 13

finalURLTemplateMethod · 0.95
tryThrottleMethod · 0.95
StreamMethod · 0.95
requestMethod · 0.95
TestRequestAbsPathJoinsFunction · 0.80
TestRequestSetsNamespaceFunction · 0.80
TestURLTemplateFunction · 0.80

Calls 4

AddMethod · 0.65
SetMethod · 0.65
StringMethod · 0.65
EncodeMethod · 0.45