mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
apiserver: Avoid panic for DELETE requests (#100372)
This commit is contained in:
parent
f2d34254d3
commit
f8efdaf88c
@ -56,6 +56,12 @@ func NewAdapter(req *http.Request) *ResponseAdapter {
|
||||
writer := bufio.NewWriter(w)
|
||||
reader := bufio.NewReader(r)
|
||||
buffered := bufio.NewReadWriter(reader, writer)
|
||||
if req.Method == http.MethodDelete && req.Body == nil {
|
||||
// The apiserver tries to read the body of DELETE requests,
|
||||
// which causes a panic if the body is nil.
|
||||
// https://github.com/kubernetes/apiserver/blob/v0.32.1/pkg/endpoints/handlers/delete.go#L88
|
||||
req.Body = http.NoBody
|
||||
}
|
||||
return &ResponseAdapter{
|
||||
req: req,
|
||||
res: http.Response{
|
||||
|
Loading…
Reference in New Issue
Block a user