From 70d1d5bf06bf3f0f1e06a5f91c6514147eceae6b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 27 Mar 2018 09:52:06 -0700 Subject: [PATCH] agent: get rid of method checks since they're done in the http layer --- agent/agent_endpoint.go | 10 ---------- agent/connect_ca_endpoint.go | 5 ----- agent/health_endpoint.go | 4 ---- agent/intentions_endpoint.go | 5 ----- 4 files changed, 24 deletions(-) diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index 1cbb4b1da7..89bf16b622 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -852,11 +852,6 @@ func (s *HTTPServer) AgentConnectCARoots(resp http.ResponseWriter, req *http.Req // AgentConnectCALeafCert returns the certificate bundle for a service // instance. This supports blocking queries to update the returned bundle. func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // Test the method - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} - } - // Get the service ID. Note that this is the ID of a service instance. id := strings.TrimPrefix(req.URL.Path, "/v1/agent/connect/ca/leaf/") @@ -890,11 +885,6 @@ func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http. // // POST /v1/agent/connect/authorize func (s *HTTPServer) AgentConnectAuthorize(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // Test the method - if req.Method != "POST" { - return nil, MethodNotAllowedError{req.Method, []string{"POST"}} - } - // NOTE(mitchellh): return 200 for now. To be implemented later. return nil, nil } diff --git a/agent/connect_ca_endpoint.go b/agent/connect_ca_endpoint.go index 7832ba36f1..43eeb8644d 100644 --- a/agent/connect_ca_endpoint.go +++ b/agent/connect_ca_endpoint.go @@ -9,11 +9,6 @@ import ( // GET /v1/connect/ca/roots func (s *HTTPServer) ConnectCARoots(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // Test the method - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} - } - var args structs.DCSpecificRequest if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done { return nil, nil diff --git a/agent/health_endpoint.go b/agent/health_endpoint.go index e57b5f48b6..a0fb177b66 100644 --- a/agent/health_endpoint.go +++ b/agent/health_endpoint.go @@ -152,10 +152,6 @@ func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Requ } func (s *HTTPServer) healthServiceNodes(resp http.ResponseWriter, req *http.Request, connect bool) (interface{}, error) { - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} - } - // Set default DC args := structs.ServiceSpecificRequest{Connect: connect} s.parseSource(req, &args.Source) diff --git a/agent/intentions_endpoint.go b/agent/intentions_endpoint.go index 5196f06c5c..5a2e0e8097 100644 --- a/agent/intentions_endpoint.go +++ b/agent/intentions_endpoint.go @@ -65,11 +65,6 @@ func (s *HTTPServer) IntentionCreate(resp http.ResponseWriter, req *http.Request // GET /v1/connect/intentions/match func (s *HTTPServer) IntentionMatch(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - // Test the method - if req.Method != "GET" { - return nil, MethodNotAllowedError{req.Method, []string{"GET"}} - } - // Prepare args args := &structs.IntentionQueryRequest{Match: &structs.IntentionQueryMatch{}} if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {