about summary refs log tree commit diff
path: root/dispatcher.go
diff options
context:
space:
mode:
Diffstat (limited to 'dispatcher.go')
-rw-r--r--dispatcher.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/dispatcher.go b/dispatcher.go
index 78c377f..a50f2e8 100644
--- a/dispatcher.go
+++ b/dispatcher.go
@@ -3,6 +3,7 @@ package mooh
 import (
 	"errors"
 	"fmt"
+	"net/http"
 )
 
 type Dispatcher struct {
@@ -38,7 +39,7 @@ func (self *Dispatcher) AddRoute(path string, method string, code func(*Request)
 	}
 }
 
-func (self *Dispatcher) Match(request Request) (*Route, error) {
+func (self *Dispatcher) Match(request *http.Request) (*Match, error) {
 
 	matches := []*Match{}
 
@@ -52,14 +53,14 @@ func (self *Dispatcher) Match(request Request) (*Route, error) {
 	if len(matches) == 0 {
 		return nil, nil
 	} else if len(matches) == 1 {
-		return &matches[0].Route, nil
+		return matches[0], nil
 	} else {
-		return self.disambiguateMatches(request.Request.URL.Path, matches)
+		return self.disambiguateMatches(request.URL.Path, matches)
 	}
 	return nil, nil
 }
 
-func (self *Dispatcher) disambiguateMatches(path string, matches []*Match) (*Route, error) {
+func (self *Dispatcher) disambiguateMatches(path string, matches []*Match) (*Match, error) {
 	min := -1
 	found := []*Match{}
 
@@ -82,7 +83,7 @@ func (self *Dispatcher) disambiguateMatches(path string, matches []*Match) (*Rou
 		err := errors.New(msg)
 		return nil, err
 	}
-	return &found[0].Route, nil
+	return found[0], nil
 }
 
 // func (*dispatcher) ListRoutes() {