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