apiserver: avoid repeated loading context for requestInfo in Namer.Name
Kubernetes-commit: 9cee586ee98bf7b5377ea04a8980f7f3fdbe5ec2
This commit is contained in:
parent
bc98e6b23d
commit
1f934a9364
|
|
@ -76,15 +76,11 @@ func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", "", fmt.Errorf("missing requestInfo")
|
return "", "", fmt.Errorf("missing requestInfo")
|
||||||
}
|
}
|
||||||
ns, err := n.Namespace(req)
|
|
||||||
if err != nil {
|
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(requestInfo.Name) == 0 {
|
if len(requestInfo.Name) == 0 {
|
||||||
return "", "", errEmptyName
|
return "", "", errEmptyName
|
||||||
}
|
}
|
||||||
return ns, requestInfo.Name, nil
|
return requestInfo.Namespace, requestInfo.Name, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// fastURLPathEncode encodes the provided path as a URL path
|
// fastURLPathEncode encodes the provided path as a URL path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue