diff --git a/staging/src/k8s.io/pod-security-admission/cmd/webhook/server/server.go b/staging/src/k8s.io/pod-security-admission/cmd/webhook/server/server.go index 782ab26c7d6..bcd2420a2a0 100644 --- a/staging/src/k8s.io/pod-security-admission/cmd/webhook/server/server.go +++ b/staging/src/k8s.io/pod-security-admission/cmd/webhook/server/server.go @@ -171,7 +171,7 @@ func (s *Server) HandleValidate(w http.ResponseWriter, r *http.Request) { defer cancel() } - if r.Body == nil { + if r.Body == nil || r.Body == http.NoBody { err = errors.New("request body is empty") klog.ErrorS(err, "bad request") http.Error(w, err.Error(), http.StatusBadRequest) diff --git a/test/images/agnhost/net/main.go b/test/images/agnhost/net/main.go index 3e4a78500fe..61bded22a7e 100644 --- a/test/images/agnhost/net/main.go +++ b/test/images/agnhost/net/main.go @@ -159,7 +159,7 @@ func handleRunRequest(w http.ResponseWriter, r *http.Request) { } runner := urlParts[2] - if r.Body == nil { + if r.Body == nil || r.Body == http.NoBody { http.Error(w, "Missing request body", 400) return }