Browse Source

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

pull/240/head
Shane Smith-Sahnow 9 years ago committed by Kamil Kisiel
parent
commit
ad4ce0eb16
  1. 2
      route.go

2
route.go

@ -153,7 +153,7 @@ func (r *Route) addRegexpMatcher(tpl string, matchHost, matchPrefix, matchQuery @@ -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 {

Loading…
Cancel
Save