Clarify comments

This commit is contained in:
Edd Steel 2018-02-17 17:46:11 -08:00
parent 61be181f6f
commit 35c2083422
No known key found for this signature in database
GPG Key ID: 33620159D40385A0
2 changed files with 3 additions and 1 deletions

View File

@ -52,6 +52,7 @@ type unboundEndpoint func(s *HTTPServer, resp http.ResponseWriter, req *http.Req
var endpoints map[string]unboundEndpoint
// allowedMethods is a map from endpoint prefix to supported HTTP methods.
// An empty slice means an endpoint handles OPTIONS requests and MethodNotFound errors itself.
var allowedMethods map[string][]string
// registerEndpoint registers a new endpoint, which should be done at package

View File

@ -59,7 +59,8 @@ func init() {
registerEndpoint("/v1/operator/autopilot/configuration", []string{"GET", "PUT"}, (*HTTPServer).OperatorAutopilotConfiguration)
registerEndpoint("/v1/operator/autopilot/health", []string{"GET"}, (*HTTPServer).OperatorServerHealth)
registerEndpoint("/v1/query", []string{"GET", "POST"}, (*HTTPServer).PreparedQueryGeneral)
// because prepared queries have more complex rules for allowed methods, handle that in the endpoint.
// specific prepared query endpoints have more complex rules for allowed methods, so
// the prefix is registered with no methods.
registerEndpoint("/v1/query/", []string{}, (*HTTPServer).PreparedQuerySpecific)
registerEndpoint("/v1/session/create", []string{"PUT"}, (*HTTPServer).SessionCreate)
registerEndpoint("/v1/session/destroy/", []string{"PUT"}, (*HTTPServer).SessionDestroy)