diff options
Diffstat (limited to 'route.go')
-rw-r--r-- | route.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/route.go b/route.go index 9eab0ab..a33a78f 100644 --- a/route.go +++ b/route.go @@ -12,12 +12,13 @@ type Route struct { Method string Path string Code fn + Validations map[string]*regexp.Regexp + Defaults map[string]string components []string requiredNamedComponents map[string]bool optionalNamedComponents map[string]bool length int lengthWithoutOptional int - Validations map[string]*regexp.Regexp } type Match struct { @@ -55,7 +56,13 @@ func (self *Route) Match(method string, components []string) *Match { return nil } - mapping := map[string]string{} + var mapping map[string]string + + if self.Defaults != nil { + mapping = self.Defaults + }else{ + mapping = map[string]string{} + } currentComponentsLength := len(components) |