mirror of https://github.com/status-im/consul.git
Initialise `allowedMethods` in init()
This commit is contained in:
parent
77f19f7505
commit
f5af8b0f03
|
@ -60,9 +60,6 @@ func registerEndpoint(pattern string, methods []string, fn unboundEndpoint) {
|
||||||
if endpoints == nil {
|
if endpoints == nil {
|
||||||
endpoints = make(map[string]unboundEndpoint)
|
endpoints = make(map[string]unboundEndpoint)
|
||||||
}
|
}
|
||||||
if allowedMethods == nil {
|
|
||||||
allowedMethods = make(map[string][]string)
|
|
||||||
}
|
|
||||||
if endpoints[pattern] != nil || allowedMethods[pattern] != nil {
|
if endpoints[pattern] != nil || allowedMethods[pattern] != nil {
|
||||||
panic(fmt.Errorf("Pattern %q is already registered", pattern))
|
panic(fmt.Errorf("Pattern %q is already registered", pattern))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package agent
|
package agent
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
allowedMethods = make(map[string][]string)
|
||||||
|
|
||||||
registerEndpoint("/v1/acl/bootstrap", []string{"PUT"}, (*HTTPServer).ACLBootstrap)
|
registerEndpoint("/v1/acl/bootstrap", []string{"PUT"}, (*HTTPServer).ACLBootstrap)
|
||||||
registerEndpoint("/v1/acl/create", []string{"PUT"}, (*HTTPServer).ACLCreate)
|
registerEndpoint("/v1/acl/create", []string{"PUT"}, (*HTTPServer).ACLCreate)
|
||||||
registerEndpoint("/v1/acl/update", []string{"PUT"}, (*HTTPServer).ACLUpdate)
|
registerEndpoint("/v1/acl/update", []string{"PUT"}, (*HTTPServer).ACLUpdate)
|
||||||
|
|
Loading…
Reference in New Issue