refactor routeRegexp, particularily newRouteRegexp. (#328)
The existing options matchPrefix, matchHost, and matchQueries are mutually exclusive so there's no point in having a separate boolean argument for each one. It's clearer if there's a single type variable. strictSlash and useEncodedPath were also being passed as naked bools so I've wrapped these in a struct called routeRegexpOptions for more clarity at the call site.
This commit is contained in:
@@ -25,7 +25,7 @@ func (r *Route) GoString() string {
|
||||
}
|
||||
|
||||
func (r *routeRegexp) GoString() string {
|
||||
return fmt.Sprintf("&routeRegexp{template: %q, matchHost: %t, matchQuery: %t, strictSlash: %t, regexp: regexp.MustCompile(%q), reverse: %q, varsN: %v, varsR: %v", r.template, r.matchHost, r.matchQuery, r.strictSlash, r.regexp.String(), r.reverse, r.varsN, r.varsR)
|
||||
return fmt.Sprintf("&routeRegexp{template: %q, regexpType: %v, options: %v, regexp: regexp.MustCompile(%q), reverse: %q, varsN: %v, varsR: %v", r.template, r.regexpType, r.options, r.regexp.String(), r.reverse, r.varsN, r.varsR)
|
||||
}
|
||||
|
||||
type routeTest struct {
|
||||
|
||||
Reference in New Issue
Block a user