Browse Source

agent: use http.StatusMethodNotAllowed instead of 405

pull/3416/head
Frank Schroeder 7 years ago committed by Frank Schröder
parent
commit
fa121be33f
  1. 6
      agent/acl_endpoint.go
  2. 8
      agent/agent_endpoint.go
  3. 2
      agent/event_endpoint.go
  4. 2
      agent/kvs_endpoint.go
  5. 4
      agent/prepared_query_endpoint.go
  6. 6
      agent/session_endpoint.go

6
agent/acl_endpoint.go

@ -51,7 +51,7 @@ func (s *HTTPServer) ACLBootstrap(resp http.ResponseWriter, req *http.Request) (
func (s *HTTPServer) ACLDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -87,7 +87,7 @@ func (s *HTTPServer) ACLUpdate(resp http.ResponseWriter, req *http.Request) (int
func (s *HTTPServer) aclSet(resp http.ResponseWriter, req *http.Request, update bool) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -130,7 +130,7 @@ func (s *HTTPServer) aclSet(resp http.ResponseWriter, req *http.Request, update
func (s *HTTPServer) ACLClone(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}

8
agent/agent_endpoint.go

@ -384,7 +384,7 @@ type checkUpdate struct {
// APIs.
func (s *HTTPServer) AgentCheckUpdate(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -530,7 +530,7 @@ func (s *HTTPServer) AgentDeregisterService(resp http.ResponseWriter, req *http.
func (s *HTTPServer) AgentServiceMaintenance(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Only PUT supported
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -586,7 +586,7 @@ func (s *HTTPServer) AgentServiceMaintenance(resp http.ResponseWriter, req *http
func (s *HTTPServer) AgentNodeMaintenance(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Only PUT supported
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -629,7 +629,7 @@ func (s *HTTPServer) AgentNodeMaintenance(resp http.ResponseWriter, req *http.Re
func (s *HTTPServer) AgentMonitor(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Only GET supported.
if req.Method != "GET" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}

2
agent/event_endpoint.go

@ -22,7 +22,7 @@ const (
func (s *HTTPServer) EventFire(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}

2
agent/kvs_endpoint.go

@ -48,7 +48,7 @@ func (s *HTTPServer) KVSEndpoint(resp http.ResponseWriter, req *http.Request) (i
case "DELETE":
return s.KVSDelete(resp, req, &args)
default:
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
}

4
agent/prepared_query_endpoint.go

@ -71,7 +71,7 @@ func (s *HTTPServer) PreparedQueryGeneral(resp http.ResponseWriter, req *http.Re
return s.preparedQueryList(resp, req)
default:
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
}
@ -261,7 +261,7 @@ func (s *HTTPServer) PreparedQuerySpecific(resp http.ResponseWriter, req *http.R
return s.preparedQueryDelete(id, resp, req)
default:
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
}

6
agent/session_endpoint.go

@ -29,7 +29,7 @@ type sessionCreateResponse struct {
func (s *HTTPServer) SessionCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -109,7 +109,7 @@ func FixupLockDelay(raw interface{}) error {
func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}
@ -138,7 +138,7 @@ func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request)
func (s *HTTPServer) SessionRenew(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
resp.WriteHeader(http.StatusMethodNotAllowed) // 405
return nil, nil
}

Loading…
Cancel
Save