diff options
-rw-r--r-- | route.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/route.go b/route.go index 49d627d..6c41c95 100644 --- a/route.go +++ b/route.go @@ -25,7 +25,7 @@ type Route struct { type Match struct { Path string Route Route - Mapping map[string]string + mapping map[string]string Method string } @@ -34,6 +34,10 @@ var componentsIsOptional = regexp.MustCompile("^\\?{.*}$") var namedComponentsRegex = regexp.MustCompile("^{(.*)}$") var convertComponent = regexp.MustCompile("^\\??{(.*)}$") +func (self *Match) RouteParams() map[string]string { + return self.mapping +} + // XXX explain this function func (self *Route) convertComponentName(name string) string { newName := convertComponent.FindStringSubmatch(name) @@ -104,7 +108,7 @@ L: Path: strings.Join(components, "/"), Route: *self, Method: method, - Mapping: mapping, + mapping: mapping, } } |