diff options
Diffstat (limited to 'route.go')
-rw-r--r-- | route.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/route.go b/route.go index 832313b..46998c1 100644 --- a/route.go +++ b/route.go @@ -1,7 +1,6 @@ package mooh import ( - "net/http" "regexp" "strings" ) @@ -36,10 +35,10 @@ func (self *Route) convertComponentName(name string) string { return newName[1] } -func (self *Route) Match(request *http.Request) *Match { +func (self *Route) Match(method string, components []string) *Match { methodMatch := false for m, _ := range self.Executors { - if m == request.Method { + if m == method { methodMatch = true } } @@ -47,7 +46,6 @@ func (self *Route) Match(request *http.Request) *Match { return nil } - components := strings.Split(request.URL.Path, "/") if len(components) < self.LengthWithoutOptional || len(components) > self.Length { return nil } @@ -70,9 +68,9 @@ func (self *Route) Match(request *http.Request) *Match { } return &Match{ - Path: request.URL.Path, + Path: strings.Join(components, "/"), Route: *self, - Method: request.Method, + Method: method, Mapping: mapping, } } |