diff --git a/pkg/kubelet/server/server.go b/pkg/kubelet/server/server.go index 4a9d9080d4c..39339d9395d 100644 --- a/pkg/kubelet/server/server.go +++ b/pkg/kubelet/server/server.go @@ -824,15 +824,17 @@ func trimURLPath(path string) string { return parts[0] } +var longRunningRequestPathMap = map[string]bool{ + "exec": true, + "attach": true, + "portforward": true, + "debug": true, +} + // isLongRunningRequest determines whether the request is long-running or not. func isLongRunningRequest(path string) bool { - longRunningRequestPaths := []string{"exec", "attach", "portforward", "debug"} - for _, p := range longRunningRequestPaths { - if p == path { - return true - } - } - return false + _, ok := longRunningRequestPathMap[path] + return ok } // ServeHTTP responds to HTTP requests on the Kubelet.