From 89f05b64e60e6d15ec234b5f90393e04df1a5484 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Wed, 14 Feb 2024 11:26:35 +0100 Subject: [PATCH] pr fix: remove DELETE from Command --- internals/daemon/api_test.go | 1 - internals/daemon/daemon.go | 4 ---- internals/daemon/daemon_test.go | 3 +-- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/internals/daemon/api_test.go b/internals/daemon/api_test.go index 79e87ec1..4ba2da15 100644 --- a/internals/daemon/api_test.go +++ b/internals/daemon/api_test.go @@ -80,7 +80,6 @@ func (s *apiSuite) TestSysInfo(c *check.C) { c.Assert(sysInfoCmd.GET, check.NotNil) c.Check(sysInfoCmd.PUT, check.IsNil) c.Check(sysInfoCmd.POST, check.IsNil) - c.Check(sysInfoCmd.DELETE, check.IsNil) rec := httptest.NewRecorder() diff --git a/internals/daemon/daemon.go b/internals/daemon/daemon.go index 8458b146..1a93393b 100644 --- a/internals/daemon/daemon.go +++ b/internals/daemon/daemon.go @@ -126,7 +126,6 @@ type Command struct { GET ResponseFunc PUT ResponseFunc POST ResponseFunc - DELETE ResponseFunc // Access control. ReadAccess accessChecker @@ -185,9 +184,6 @@ func (c *Command) ServeHTTP(w http.ResponseWriter, r *http.Request) { case "POST": rspf = c.POST access = c.WriteAccess - case "DELETE": - rspf = c.DELETE - access = c.WriteAccess } if rspf == nil { diff --git a/internals/daemon/daemon_test.go b/internals/daemon/daemon_test.go index 907e39a8..257540c6 100644 --- a/internals/daemon/daemon_test.go +++ b/internals/daemon/daemon_test.go @@ -222,9 +222,8 @@ func (s *daemonSuite) TestCommandMethodDispatch(c *C) { cmd.GET = rf cmd.PUT = rf cmd.POST = rf - cmd.DELETE = rf - for _, method := range []string{"GET", "POST", "PUT", "DELETE"} { + for _, method := range []string{"GET", "POST", "PUT"} { req, err := http.NewRequest(method, "", nil) req.Header.Add("User-Agent", fakeUserAgent) c.Assert(err, IsNil)