diff options
author | Franck Cuny <franck@lumberjaph.net> | 2013-05-08 21:13:43 -0700 |
---|---|---|
committer | Franck Cuny <franck@lumberjaph.net> | 2013-05-08 21:13:43 -0700 |
commit | 7f419b0c2c86eb0b8c711b47392998e33e34bf9d (patch) | |
tree | cb464077fad4facbbeb65e2b58e66272b80d38cb /router_test.go | |
parent | Rename the package from mooh to router (diff) | |
download | path-router-7f419b0c2c86eb0b8c711b47392998e33e34bf9d.tar.gz |
Clean up messy path before matching a request.
Try to clean up messy path (too many slashes for now) in the path before applying the Match.
Diffstat (limited to '')
-rw-r--r-- | router_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/router_test.go b/router_test.go index cb18fba..71fdcaf 100644 --- a/router_test.go +++ b/router_test.go @@ -2,6 +2,8 @@ package router import ( "github.com/franckcuny/web-request" + "net/http" + "net/url" "testing" ) @@ -142,3 +144,14 @@ func TestAddNotAllowed(t *testing.T) { t.Fatal() } } + +func TestMessyPath(t *testing.T) { + r := BuildRouter() + r.AddRoute(&Route{Method: "GET", Path: "/baz", Code: testRoute}) + req := &http.Request{Method: "GET", URL: &url.URL{Path: "///////baz"}} + m, _ := r.Match(req) + + if m == nil { + t.Fatal() + } +} |