updating logic in route matcher, cleaner and saner (#235)
This commit is contained in:
committed by
Kamil Kisiel
parent
999ef73f5d
commit
ad4ce0eb16
2
route.go
2
route.go
@@ -153,7 +153,7 @@ func (r *Route) addRegexpMatcher(tpl string, matchHost, matchPrefix, matchQuery
|
|||||||
}
|
}
|
||||||
r.regexp = r.getRegexpGroup()
|
r.regexp = r.getRegexpGroup()
|
||||||
if !matchHost && !matchQuery {
|
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)
|
return fmt.Errorf("mux: path must start with a slash, got %q", tpl)
|
||||||
}
|
}
|
||||||
if r.regexp.path != nil {
|
if r.regexp.path != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user