From 630c6cc16aa25ebdb7bc896cf2f61a55e841e148 Mon Sep 17 00:00:00 2001 From: deads2k Date: Mon, 21 Sep 2015 13:55:03 -0400 Subject: [PATCH] add patch verb to APIRequestInfo --- pkg/apiserver/handlers.go | 2 ++ pkg/apiserver/handlers_test.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pkg/apiserver/handlers.go b/pkg/apiserver/handlers.go index 6f12269bdec..eda608b5488 100644 --- a/pkg/apiserver/handlers.go +++ b/pkg/apiserver/handlers.go @@ -495,6 +495,8 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques requestInfo.Verb = "get" case "PUT": requestInfo.Verb = "update" + case "PATCH": + requestInfo.Verb = "patch" case "DELETE": requestInfo.Verb = "delete" } diff --git a/pkg/apiserver/handlers_test.go b/pkg/apiserver/handlers_test.go index cab2f0c4fb0..1ef84b506b3 100644 --- a/pkg/apiserver/handlers_test.go +++ b/pkg/apiserver/handlers_test.go @@ -243,6 +243,10 @@ func TestGetAPIRequestInfo(t *testing.T) { // subresource identification {"GET", "/namespaces/other/pods/foo/status", "get", "", "other", "pods", "status", "Pod", "foo", []string{"pods", "foo", "status"}}, {"PUT", "/namespaces/other/finalize", "update", "", "other", "finalize", "", "", "", []string{"finalize"}}, + + // verb identification + {"PATCH", "/namespaces/other/pods/foo", "patch", "", "other", "pods", "", "Pod", "foo", []string{"pods", "foo"}}, + {"DELETE", "/namespaces/other/pods/foo", "delete", "", "other", "pods", "", "Pod", "foo", []string{"pods", "foo"}}, } apiRequestInfoResolver := &APIRequestInfoResolver{sets.NewString("api"), testapi.Default.RESTMapper()}