diff options
Diffstat (limited to 'route.go')
-rw-r--r-- | route.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/route.go b/route.go index 768315e..f17fe7b 100644 --- a/route.go +++ b/route.go @@ -3,6 +3,7 @@ package mooh import ( "regexp" "strings" + "net/http" ) type fn func(*Request) (Response, error) @@ -29,7 +30,7 @@ var componentIsVariable = regexp.MustCompile("^:") var componentsIsOptional = regexp.MustCompile("^?:") var namedComponentsRegex = regexp.MustCompile("^:(.*)$") -func (self *Route) Match(request Request) *Match { +func (self *Route) Match(request *http.Request) *Match { methodMatch := false for m, _ := range self.Executors { if m == request.Method { @@ -40,7 +41,7 @@ func (self *Route) Match(request Request) *Match { return nil } - components := strings.Split(request.Request.URL.Path, "/") + components := strings.Split(request.URL.Path, "/") if len(components) < self.LengthWithoutOptional || len(components) > self.Length { return nil } @@ -63,7 +64,7 @@ func (self *Route) Match(request Request) *Match { } return &Match{ - Path: request.Request.URL.Path, + Path: request.URL.Path, Route: *self, Method: request.Method, Mapping: mapping, |