agent: use http.StatusMethodNotAllowed instead of 405

This commit is contained in:
Frank Schroeder 2017-08-23 16:21:55 +02:00 committed by Frank Schröder
parent 0c3534cbf7
commit bf426beb45
6 changed files with 14 additions and 14 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}