mirror of https://github.com/status-im/consul.git
agent: use http.StatusMethodNotAllowed instead of 405
This commit is contained in:
parent
ad5c1d9e72
commit
fa121be33f
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue