From 35c208342257f5147161dd02a73addd249d420aa Mon Sep 17 00:00:00 2001 From: Edd Steel Date: Sat, 17 Feb 2018 17:46:11 -0800 Subject: [PATCH] Clarify comments --- agent/http.go | 1 + agent/http_oss.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/agent/http.go b/agent/http.go index 8a3d78c0e..823606f2f 100644 --- a/agent/http.go +++ b/agent/http.go @@ -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 diff --git a/agent/http_oss.go b/agent/http_oss.go index f4ea138d8..4a2017d28 100644 --- a/agent/http_oss.go +++ b/agent/http_oss.go @@ -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)