MCPcopy
hub / github.com/caddyserver/caddy / handleAPIEndpoints

Method handleAPIEndpoints

modules/caddypki/adminapi.go:75–88  ·  view source on GitHub ↗

handleAPIEndpoints routes API requests within adminPKIEndpointBase.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

73
74// handleAPIEndpoints routes API requests within adminPKIEndpointBase.
75func (a *adminAPI) handleAPIEndpoints(w http.ResponseWriter, r *http.Request) error {
76 uri := strings.TrimPrefix(r.URL.Path, "/pki/")
77 parts := strings.Split(uri, "/")
78 switch {
79 case len(parts) == 2 && parts[0] == "ca" && parts[1] != "":
80 return a.handleCAInfo(w, r)
81 case len(parts) == 3 && parts[0] == "ca" && parts[1] != "" && parts[2] == "certificates":
82 return a.handleCACerts(w, r)
83 }
84 return caddy.APIError{
85 HTTPStatus: http.StatusNotFound,
86 Err: fmt.Errorf("resource not found: %v", r.URL.Path),
87 }
88}
89
90// handleCAInfo returns information about a particular
91// CA by its ID. If the CA ID is the default, then the CA will be

Callers

nothing calls this directly

Calls 2

handleCAInfoMethod · 0.95
handleCACertsMethod · 0.95

Tested by

no test coverage detected