From 68fa4a83b1c84340fd845dcc9d4318b431661787 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 1cbb4b1da..89bf16b62 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 7832ba36f..43eeb8644 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 e57b5f48b..a0fb177b6 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 5196f06c5..5a2e0e809 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 {