From 7c3df7703f2f573138f10eeb2d03ab8136411a32 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Wed, 11 Apr 2018 22:34:01 -0700 Subject: [PATCH] Revert "Allow parameter routes to end with a dot (/foo/:id.json)" This reverts commit bfa14633f3e679c24a0bc647a9445a1237127f17. --- router.go | 2 +- router_test.go | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/router.go b/router.go index 0ebdee4e..ff53da87 100644 --- a/router.go +++ b/router.go @@ -378,7 +378,7 @@ func (r *Router) Find(method, path string, c Context) { cn = child i, l := 0, len(search) - for ; i < l && search[i] != '/' && search[i] != '.'; i++ { + for ; i < l && search[i] != '/'; i++ { } pvalues[n] = search[:i] n++ diff --git a/router_test.go b/router_test.go index 53906db7..3a8b2596 100644 --- a/router_test.go +++ b/router_test.go @@ -784,9 +784,6 @@ func TestRouterParamNames(t *testing.T) { r.Add(GET, "/users/:id", func(c Context) error { return nil }) - r.Add(GET, "/companies/:id.json", func(c Context) error { - return nil - }) r.Add(GET, "/users/:uid/files/:fid", func(c Context) error { return nil }) @@ -802,11 +799,6 @@ func TestRouterParamNames(t *testing.T) { assert.Equal(t, "id", c.pnames[0]) assert.Equal(t, "1", c.Param("id")) - // Route -> /companies/:id.json - r.Find(GET, "/companies/1.json", c) - assert.Equal(t, "id", c.pnames[0]) - assert.Equal(t, "1", c.Param("id")) - // Route > /users/:uid/files/:fid r.Find(GET, "/users/1/files/1", c) assert.Equal(t, "uid", c.pnames[0])