Merge pull request #4461 from deads2k/deads-expose-info-resolver

expose creation APIRequestInfoResolver
This commit is contained in:
Clayton Coleman 2015-02-16 16:51:47 -05:00
commit f27bcf50f2

View File

@ -218,8 +218,8 @@ type APIRequestInfo struct {
} }
type APIRequestInfoResolver struct { type APIRequestInfoResolver struct {
apiPrefixes util.StringSet APIPrefixes util.StringSet
restMapper meta.RESTMapper RestMapper meta.RESTMapper
} }
// GetAPIRequestInfo returns the information from the http request. If error is not nil, APIRequestInfo holds the information as best it is known before the failure // GetAPIRequestInfo returns the information from the http request. If error is not nil, APIRequestInfo holds the information as best it is known before the failure
@ -253,7 +253,7 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
return requestInfo, fmt.Errorf("Unable to determine kind and namespace from an empty URL path") return requestInfo, fmt.Errorf("Unable to determine kind and namespace from an empty URL path")
} }
for _, currPrefix := range r.apiPrefixes.List() { for _, currPrefix := range r.APIPrefixes.List() {
// handle input of form /api/{version}/* by adjusting special paths // handle input of form /api/{version}/* by adjusting special paths
if currentParts[0] == currPrefix { if currentParts[0] == currPrefix {
if len(currentParts) > 1 { if len(currentParts) > 1 {
@ -334,7 +334,7 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
// if we have a resource, we have a good shot at being able to determine kind // if we have a resource, we have a good shot at being able to determine kind
if len(requestInfo.Resource) > 0 { if len(requestInfo.Resource) > 0 {
_, requestInfo.Kind, _ = r.restMapper.VersionAndKindForResource(requestInfo.Resource) _, requestInfo.Kind, _ = r.RestMapper.VersionAndKindForResource(requestInfo.Resource)
} }
return requestInfo, nil return requestInfo, nil