diff --git a/pkg/router/lm/lm.go b/pkg/router/lm/lm.go index e45e8ed99..349f7bd9a 100644 --- a/pkg/router/lm/lm.go +++ b/pkg/router/lm/lm.go @@ -40,7 +40,7 @@ func (rt *rtr) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func (rt *rtr) RegisterRoute(path string, hosts, methods []string, - isWildcard bool, handler http.Handler) error { + matchPrefix bool, handler http.Handler) error { pl := len(path) if pl == 0 { return errors.ErrInvalidPath @@ -61,7 +61,7 @@ func (rt *rtr) RegisterRoute(path string, hosts, methods []string, } rt.routes[h] = hrc } - if !isWildcard { + if !matchPrefix { rl, ok := hrc.ExactMatchRoutes[path] if rl == nil || !ok { rl = make(router.RouteLookup) @@ -127,7 +127,7 @@ func (rt *rtr) RegisterRoute(path string, hosts, methods []string, return nil } -// this sorts the prefix-match paths longest to shorted +// this sorts the prefix-match paths longest to shortest func (rt *rtr) sort() { for _, hrc := range rt.routes { if len(hrc.PrefixMatchRoutes) == 0 { diff --git a/pkg/router/router.go b/pkg/router/router.go index 10cd1dca4..627020714 100644 --- a/pkg/router/router.go +++ b/pkg/router/router.go @@ -8,7 +8,7 @@ type Router interface { // ServeHTTP services the provided HTTP Request and write the Response ServeHTTP(http.ResponseWriter, *http.Request) // RegisterRoute registers a handler for the provided path/host/method(s) - RegisterRoute(path string, hosts, methods []string, isWildcard bool, + RegisterRoute(path string, hosts, methods []string, matchPrefix bool, handler http.Handler) error // Handler returns the handler matching the method/host/path in the Request Handler(*http.Request) http.Handler