apiserver: avoid repeated loading context for requestInfo in Namer.Name

This commit is contained in:
j2gg0s 2021-07-28 19:04:48 +08:00
parent fffaadc013
commit 9cee586ee9

View File

@ -76,15 +76,11 @@ func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err
if !ok {
return "", "", fmt.Errorf("missing requestInfo")
}
ns, err := n.Namespace(req)
if err != nil {
return "", "", err
}
if len(requestInfo.Name) == 0 {
return "", "", errEmptyName
}
return ns, requestInfo.Name, nil
return requestInfo.Namespace, requestInfo.Name, nil
}
// fastURLPathEncode encodes the provided path as a URL path