handleAPIEndpoints routes API requests within adminPKIEndpointBase.
(w http.ResponseWriter, r *http.Request)
| 73 | |
| 74 | // handleAPIEndpoints routes API requests within adminPKIEndpointBase. |
| 75 | func (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 |
nothing calls this directly
no test coverage detected