Browse Source

Initialise `allowedMethods` in init()

pull/3885/head
Edd Steel 7 years ago
parent
commit
f5af8b0f03
No known key found for this signature in database
GPG Key ID: 33620159D40385A0
  1. 3
      agent/http.go
  2. 2
      agent/http_oss.go

3
agent/http.go

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

2
agent/http_oss.go

@ -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…
Cancel
Save