diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index 4a9e952f8175..0b22c5aafb69 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -347,9 +347,8 @@ func (s *HTTPServer) AgentDeregisterCheck(resp http.ResponseWriter, req *http.Re } func (s *HTTPServer) AgentCheckPass(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // todo(fs): why GET? - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} + if req.Method != "PUT" { + return nil, MethodNotAllowedError{req.Method, []string{"PUT"}} } checkID := types.CheckID(strings.TrimPrefix(req.URL.Path, "/v1/agent/check/pass/")) @@ -370,9 +369,8 @@ func (s *HTTPServer) AgentCheckPass(resp http.ResponseWriter, req *http.Request) } func (s *HTTPServer) AgentCheckWarn(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // todo(fs): why GET? - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} + if req.Method != "PUT" { + return nil, MethodNotAllowedError{req.Method, []string{"PUT"}} } checkID := types.CheckID(strings.TrimPrefix(req.URL.Path, "/v1/agent/check/warn/")) @@ -393,9 +391,8 @@ func (s *HTTPServer) AgentCheckWarn(resp http.ResponseWriter, req *http.Request) } func (s *HTTPServer) AgentCheckFail(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // todo(fs): why GET? - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} + if req.Method != "PUT" { + return nil, MethodNotAllowedError{req.Method, []string{"PUT"}} } checkID := types.CheckID(strings.TrimPrefix(req.URL.Path, "/v1/agent/check/fail/")) diff --git a/agent/http_test.go b/agent/http_test.go index e09f9936aeac..fc64c822cff6 100644 --- a/agent/http_test.go +++ b/agent/http_test.go @@ -320,11 +320,11 @@ func TestHTTPAPI_MethodNotAllowed(t *testing.T) { {"GET", "/v1/agent/self"}, {"GET", "/v1/agent/members"}, {"PUT", "/v1/agent/check/deregister/"}, - {"GET", "/v1/agent/check/fail/"}, // GET ?? - {"GET", "/v1/agent/check/pass/"}, // GET ?? + {"PUT", "/v1/agent/check/fail/"}, + {"PUT", "/v1/agent/check/pass/"}, {"PUT", "/v1/agent/check/register"}, {"PUT", "/v1/agent/check/update/"}, - {"GET", "/v1/agent/check/warn/"}, // GET ?? + {"PUT", "/v1/agent/check/warn/"}, {"GET", "/v1/agent/checks"}, {"PUT", "/v1/agent/force-leave/"}, {"PUT", "/v1/agent/join/"}, diff --git a/website/source/api/agent/check.html.md b/website/source/api/agent/check.html.md index 90c8e7684114..31c150c07c32 100644 --- a/website/source/api/agent/check.html.md +++ b/website/source/api/agent/check.html.md @@ -214,7 +214,7 @@ This endpoint is used with a TTL type check to set the status of the check to | Method | Path | Produces | | ------ | ----------------------------- | -------------------------- | -| `GET` | `/agent/check/pass/:check_id` | `application/json` | +| `PUT` | `/agent/check/pass/:check_id` | `application/json` | The table below shows this endpoint's support for [blocking queries](/api/index.html#blocking-queries), @@ -247,7 +247,7 @@ This endpoint is used with a TTL type check to set the status of the check to | Method | Path | Produces | | ------ | ----------------------------- | -------------------------- | -| `GET` | `/agent/check/warn/:check_id` | `application/json` | +| `PUT` | `/agent/check/warn/:check_id` | `application/json` | The table below shows this endpoint's support for [blocking queries](/api/index.html#blocking-queries), @@ -280,7 +280,7 @@ This endpoint is used with a TTL type check to set the status of the check to | Method | Path | Produces | | ------ | ----------------------------- | -------------------------- | -| `GET` | `/agent/check/fail/:check_id` | `application/json` | +| `PUT` | `/agent/check/fail/:check_id` | `application/json` | The table below shows this endpoint's support for [blocking queries](/api/index.html#blocking-queries),