updating logic in route matcher, cleaner and saner (#235)

This commit is contained in:
Shane Smith-Sahnow
2017-02-27 19:44:49 -08:00
committed by Kamil Kisiel
parent 999ef73f5d
commit ad4ce0eb16

View File

@@ -153,7 +153,7 @@ func (r *Route) addRegexpMatcher(tpl string, matchHost, matchPrefix, matchQuery
}
r.regexp = r.getRegexpGroup()
if !matchHost && !matchQuery {
if tpl == "/" && (len(tpl) == 0 || tpl[0] != '/') {
if len(tpl) > 0 && tpl[0] != '/' {
return fmt.Errorf("mux: path must start with a slash, got %q", tpl)
}
if r.regexp.path != nil {