Commit caff6337 authored by Geoff Simmons's avatar Geoff Simmons

Fix REST server mux for /v1/pems*.

parent 3475cc7b
...@@ -46,7 +46,7 @@ const ( ...@@ -46,7 +46,7 @@ const (
) )
var ( var (
pemsRegex = regexp.MustCompile("^" + pemsPfx + "/([^/]+)/([^/]+)$") pemsRegex = regexp.MustCompile("^" + pemsPfx + "([^/]+)/([^/]+)$")
allowedHealthz = map[string]struct{}{ allowedHealthz = map[string]struct{}{
http.MethodGet: struct{}{}, http.MethodGet: struct{}{},
...@@ -130,7 +130,7 @@ func (h *pemsHndlr) allPems( ...@@ -130,7 +130,7 @@ func (h *pemsHndlr) allPems(
func (h *pemsHndlr) ServeHTTP(resp http.ResponseWriter, req *http.Request) { func (h *pemsHndlr) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
now := time.Now() now := time.Now()
if req.URL.Path == pemsPfx { if req.URL.Path == pemsAll {
h.allPems(resp, req, now) h.allPems(resp, req, now)
return return
} }
......
...@@ -43,7 +43,8 @@ import ( ...@@ -43,7 +43,8 @@ import (
const ( const (
healthzPath = "/v1/healthz" healthzPath = "/v1/healthz"
pemsPfx = "/v1/pems" pemsPfx = "/v1/pems/"
pemsAll = "/v1/pems"
) )
// Server encapsulates the HTTP server for the REST API. // Server encapsulates the HTTP server for the REST API.
...@@ -158,11 +159,13 @@ func (srv *Server) Start() error { ...@@ -158,11 +159,13 @@ func (srv *Server) Start() error {
log: srv.log, log: srv.log,
version: srv.version, version: srv.version,
}) })
mux.Handle(pemsPfx, &pemsHndlr{ pemsHandler := &pemsHndlr{
log: srv.log, log: srv.log,
files: srv.files, files: srv.files,
crtGetter: srv.crtGetter, crtGetter: srv.crtGetter,
}) }
mux.Handle(pemsPfx, pemsHandler)
mux.Handle(pemsAll, pemsHandler)
srv.server = http.Server{Handler: mux} srv.server = http.Server{Handler: mux}
go func() { go func() {
if err := srv.server.Serve(lsnr); err != nil { if err := srv.server.Serve(lsnr); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment