mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
refine: the server-side http Request Body is always non-nil (#115908)
* refine: the server-side http Request Body is always non-nil * revert changes under vendor * Update staging/src/k8s.io/pod-security-admission/cmd/webhook/server/server.go Co-authored-by: Jordan Liggitt <jordan@liggitt.net> * Update main.go --------- Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
This commit is contained in:
parent
78c0018ca0
commit
d49bff855f
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user