mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
add patch verb to APIRequestInfo
This commit is contained in:
parent
11c31aeca7
commit
630c6cc16a
@ -495,6 +495,8 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
|
|||||||
requestInfo.Verb = "get"
|
requestInfo.Verb = "get"
|
||||||
case "PUT":
|
case "PUT":
|
||||||
requestInfo.Verb = "update"
|
requestInfo.Verb = "update"
|
||||||
|
case "PATCH":
|
||||||
|
requestInfo.Verb = "patch"
|
||||||
case "DELETE":
|
case "DELETE":
|
||||||
requestInfo.Verb = "delete"
|
requestInfo.Verb = "delete"
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,10 @@ func TestGetAPIRequestInfo(t *testing.T) {
|
|||||||
// subresource identification
|
// subresource identification
|
||||||
{"GET", "/namespaces/other/pods/foo/status", "get", "", "other", "pods", "status", "Pod", "foo", []string{"pods", "foo", "status"}},
|
{"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"}},
|
{"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()}
|
apiRequestInfoResolver := &APIRequestInfoResolver{sets.NewString("api"), testapi.Default.RESTMapper()}
|
||||||
|
Loading…
Reference in New Issue
Block a user