1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-28 08:38:39 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-10-14 14:52:40 -07:00
parent 60ce130499
commit 2bdbf6918e
3 changed files with 181 additions and 144 deletions

View File

@ -16,6 +16,11 @@ type (
// Use implements `Echo#Use()` for sub-routes within the Group.
func (g *Group) Use(m ...MiddlewareFunc) {
g.middleware = append(g.middleware, m...)
// Allow all requests to reach the group as they might get dropped if router
// doesn't find a match, making none of the group middleware process.
g.echo.Any(g.prefix+"*", func(c Context) error {
return ErrNotFound
}, g.middleware...)
}
// CONNECT implements `Echo#CONNECT()` for sub-routes within the Group.

View File

@ -343,7 +343,7 @@ func (r *Router) Find(method, path string, context Context) {
// Static node
if c = cn.findChild(search[0], skind); c != nil {
// Save next
if cn.label == '/' {
if cn.prefix[len(cn.prefix)-1] == '/' { // Issue #623
nk = pkind
nn = cn
ns = search
@ -361,7 +361,7 @@ func (r *Router) Find(method, path string, context Context) {
}
// Save next
if cn.label == '/' {
if cn.prefix[len(cn.prefix)-1] == '/' { // Issue #623
nk = akind
nn = cn
ns = search

View File

@ -11,262 +11,262 @@ import (
var (
api = []Route{
// OAuth Authorizations
{"GET", "/authorizations", ""},
{"GET", "/authorizations/:id", ""},
{GET, "/authorizations", ""},
{GET, "/authorizations/:id", ""},
{"POST", "/authorizations", ""},
//{"PUT", "/authorizations/clients/:client_id", ""},
//{"PATCH", "/authorizations/:id", ""},
{"DELETE", "/authorizations/:id", ""},
{"GET", "/applications/:client_id/tokens/:access_token", ""},
{GET, "/applications/:client_id/tokens/:access_token", ""},
{"DELETE", "/applications/:client_id/tokens", ""},
{"DELETE", "/applications/:client_id/tokens/:access_token", ""},
// Activity
{"GET", "/events", ""},
{"GET", "/repos/:owner/:repo/events", ""},
{"GET", "/networks/:owner/:repo/events", ""},
{"GET", "/orgs/:org/events", ""},
{"GET", "/users/:user/received_events", ""},
{"GET", "/users/:user/received_events/public", ""},
{"GET", "/users/:user/events", ""},
{"GET", "/users/:user/events/public", ""},
{"GET", "/users/:user/events/orgs/:org", ""},
{"GET", "/feeds", ""},
{"GET", "/notifications", ""},
{"GET", "/repos/:owner/:repo/notifications", ""},
{GET, "/events", ""},
{GET, "/repos/:owner/:repo/events", ""},
{GET, "/networks/:owner/:repo/events", ""},
{GET, "/orgs/:org/events", ""},
{GET, "/users/:user/received_events", ""},
{GET, "/users/:user/received_events/public", ""},
{GET, "/users/:user/events", ""},
{GET, "/users/:user/events/public", ""},
{GET, "/users/:user/events/orgs/:org", ""},
{GET, "/feeds", ""},
{GET, "/notifications", ""},
{GET, "/repos/:owner/:repo/notifications", ""},
{"PUT", "/notifications", ""},
{"PUT", "/repos/:owner/:repo/notifications", ""},
{"GET", "/notifications/threads/:id", ""},
{GET, "/notifications/threads/:id", ""},
//{"PATCH", "/notifications/threads/:id", ""},
{"GET", "/notifications/threads/:id/subscription", ""},
{GET, "/notifications/threads/:id/subscription", ""},
{"PUT", "/notifications/threads/:id/subscription", ""},
{"DELETE", "/notifications/threads/:id/subscription", ""},
{"GET", "/repos/:owner/:repo/stargazers", ""},
{"GET", "/users/:user/starred", ""},
{"GET", "/user/starred", ""},
{"GET", "/user/starred/:owner/:repo", ""},
{GET, "/repos/:owner/:repo/stargazers", ""},
{GET, "/users/:user/starred", ""},
{GET, "/user/starred", ""},
{GET, "/user/starred/:owner/:repo", ""},
{"PUT", "/user/starred/:owner/:repo", ""},
{"DELETE", "/user/starred/:owner/:repo", ""},
{"GET", "/repos/:owner/:repo/subscribers", ""},
{"GET", "/users/:user/subscriptions", ""},
{"GET", "/user/subscriptions", ""},
{"GET", "/repos/:owner/:repo/subscription", ""},
{GET, "/repos/:owner/:repo/subscribers", ""},
{GET, "/users/:user/subscriptions", ""},
{GET, "/user/subscriptions", ""},
{GET, "/repos/:owner/:repo/subscription", ""},
{"PUT", "/repos/:owner/:repo/subscription", ""},
{"DELETE", "/repos/:owner/:repo/subscription", ""},
{"GET", "/user/subscriptions/:owner/:repo", ""},
{GET, "/user/subscriptions/:owner/:repo", ""},
{"PUT", "/user/subscriptions/:owner/:repo", ""},
{"DELETE", "/user/subscriptions/:owner/:repo", ""},
// Gists
{"GET", "/users/:user/gists", ""},
{"GET", "/gists", ""},
//{"GET", "/gists/public", ""},
//{"GET", "/gists/starred", ""},
{"GET", "/gists/:id", ""},
{GET, "/users/:user/gists", ""},
{GET, "/gists", ""},
//{GET, "/gists/public", ""},
//{GET, "/gists/starred", ""},
{GET, "/gists/:id", ""},
{"POST", "/gists", ""},
//{"PATCH", "/gists/:id", ""},
{"PUT", "/gists/:id/star", ""},
{"DELETE", "/gists/:id/star", ""},
{"GET", "/gists/:id/star", ""},
{GET, "/gists/:id/star", ""},
{"POST", "/gists/:id/forks", ""},
{"DELETE", "/gists/:id", ""},
// Git Data
{"GET", "/repos/:owner/:repo/git/blobs/:sha", ""},
{GET, "/repos/:owner/:repo/git/blobs/:sha", ""},
{"POST", "/repos/:owner/:repo/git/blobs", ""},
{"GET", "/repos/:owner/:repo/git/commits/:sha", ""},
{GET, "/repos/:owner/:repo/git/commits/:sha", ""},
{"POST", "/repos/:owner/:repo/git/commits", ""},
//{"GET", "/repos/:owner/:repo/git/refs/*ref", ""},
{"GET", "/repos/:owner/:repo/git/refs", ""},
//{GET, "/repos/:owner/:repo/git/refs/*ref", ""},
{GET, "/repos/:owner/:repo/git/refs", ""},
{"POST", "/repos/:owner/:repo/git/refs", ""},
//{"PATCH", "/repos/:owner/:repo/git/refs/*ref", ""},
//{"DELETE", "/repos/:owner/:repo/git/refs/*ref", ""},
{"GET", "/repos/:owner/:repo/git/tags/:sha", ""},
{GET, "/repos/:owner/:repo/git/tags/:sha", ""},
{"POST", "/repos/:owner/:repo/git/tags", ""},
{"GET", "/repos/:owner/:repo/git/trees/:sha", ""},
{GET, "/repos/:owner/:repo/git/trees/:sha", ""},
{"POST", "/repos/:owner/:repo/git/trees", ""},
// Issues
{"GET", "/issues", ""},
{"GET", "/user/issues", ""},
{"GET", "/orgs/:org/issues", ""},
{"GET", "/repos/:owner/:repo/issues", ""},
{"GET", "/repos/:owner/:repo/issues/:number", ""},
{GET, "/issues", ""},
{GET, "/user/issues", ""},
{GET, "/orgs/:org/issues", ""},
{GET, "/repos/:owner/:repo/issues", ""},
{GET, "/repos/:owner/:repo/issues/:number", ""},
{"POST", "/repos/:owner/:repo/issues", ""},
//{"PATCH", "/repos/:owner/:repo/issues/:number", ""},
{"GET", "/repos/:owner/:repo/assignees", ""},
{"GET", "/repos/:owner/:repo/assignees/:assignee", ""},
{"GET", "/repos/:owner/:repo/issues/:number/comments", ""},
//{"GET", "/repos/:owner/:repo/issues/comments", ""},
//{"GET", "/repos/:owner/:repo/issues/comments/:id", ""},
{GET, "/repos/:owner/:repo/assignees", ""},
{GET, "/repos/:owner/:repo/assignees/:assignee", ""},
{GET, "/repos/:owner/:repo/issues/:number/comments", ""},
//{GET, "/repos/:owner/:repo/issues/comments", ""},
//{GET, "/repos/:owner/:repo/issues/comments/:id", ""},
{"POST", "/repos/:owner/:repo/issues/:number/comments", ""},
//{"PATCH", "/repos/:owner/:repo/issues/comments/:id", ""},
//{"DELETE", "/repos/:owner/:repo/issues/comments/:id", ""},
{"GET", "/repos/:owner/:repo/issues/:number/events", ""},
//{"GET", "/repos/:owner/:repo/issues/events", ""},
//{"GET", "/repos/:owner/:repo/issues/events/:id", ""},
{"GET", "/repos/:owner/:repo/labels", ""},
{"GET", "/repos/:owner/:repo/labels/:name", ""},
{GET, "/repos/:owner/:repo/issues/:number/events", ""},
//{GET, "/repos/:owner/:repo/issues/events", ""},
//{GET, "/repos/:owner/:repo/issues/events/:id", ""},
{GET, "/repos/:owner/:repo/labels", ""},
{GET, "/repos/:owner/:repo/labels/:name", ""},
{"POST", "/repos/:owner/:repo/labels", ""},
//{"PATCH", "/repos/:owner/:repo/labels/:name", ""},
{"DELETE", "/repos/:owner/:repo/labels/:name", ""},
{"GET", "/repos/:owner/:repo/issues/:number/labels", ""},
{GET, "/repos/:owner/:repo/issues/:number/labels", ""},
{"POST", "/repos/:owner/:repo/issues/:number/labels", ""},
{"DELETE", "/repos/:owner/:repo/issues/:number/labels/:name", ""},
{"PUT", "/repos/:owner/:repo/issues/:number/labels", ""},
{"DELETE", "/repos/:owner/:repo/issues/:number/labels", ""},
{"GET", "/repos/:owner/:repo/milestones/:number/labels", ""},
{"GET", "/repos/:owner/:repo/milestones", ""},
{"GET", "/repos/:owner/:repo/milestones/:number", ""},
{GET, "/repos/:owner/:repo/milestones/:number/labels", ""},
{GET, "/repos/:owner/:repo/milestones", ""},
{GET, "/repos/:owner/:repo/milestones/:number", ""},
{"POST", "/repos/:owner/:repo/milestones", ""},
//{"PATCH", "/repos/:owner/:repo/milestones/:number", ""},
{"DELETE", "/repos/:owner/:repo/milestones/:number", ""},
// Miscellaneous
{"GET", "/emojis", ""},
{"GET", "/gitignore/templates", ""},
{"GET", "/gitignore/templates/:name", ""},
{GET, "/emojis", ""},
{GET, "/gitignore/templates", ""},
{GET, "/gitignore/templates/:name", ""},
{"POST", "/markdown", ""},
{"POST", "/markdown/raw", ""},
{"GET", "/meta", ""},
{"GET", "/rate_limit", ""},
{GET, "/meta", ""},
{GET, "/rate_limit", ""},
// Organizations
{"GET", "/users/:user/orgs", ""},
{"GET", "/user/orgs", ""},
{"GET", "/orgs/:org", ""},
{GET, "/users/:user/orgs", ""},
{GET, "/user/orgs", ""},
{GET, "/orgs/:org", ""},
//{"PATCH", "/orgs/:org", ""},
{"GET", "/orgs/:org/members", ""},
{"GET", "/orgs/:org/members/:user", ""},
{GET, "/orgs/:org/members", ""},
{GET, "/orgs/:org/members/:user", ""},
{"DELETE", "/orgs/:org/members/:user", ""},
{"GET", "/orgs/:org/public_members", ""},
{"GET", "/orgs/:org/public_members/:user", ""},
{GET, "/orgs/:org/public_members", ""},
{GET, "/orgs/:org/public_members/:user", ""},
{"PUT", "/orgs/:org/public_members/:user", ""},
{"DELETE", "/orgs/:org/public_members/:user", ""},
{"GET", "/orgs/:org/teams", ""},
{"GET", "/teams/:id", ""},
{GET, "/orgs/:org/teams", ""},
{GET, "/teams/:id", ""},
{"POST", "/orgs/:org/teams", ""},
//{"PATCH", "/teams/:id", ""},
{"DELETE", "/teams/:id", ""},
{"GET", "/teams/:id/members", ""},
{"GET", "/teams/:id/members/:user", ""},
{GET, "/teams/:id/members", ""},
{GET, "/teams/:id/members/:user", ""},
{"PUT", "/teams/:id/members/:user", ""},
{"DELETE", "/teams/:id/members/:user", ""},
{"GET", "/teams/:id/repos", ""},
{"GET", "/teams/:id/repos/:owner/:repo", ""},
{GET, "/teams/:id/repos", ""},
{GET, "/teams/:id/repos/:owner/:repo", ""},
{"PUT", "/teams/:id/repos/:owner/:repo", ""},
{"DELETE", "/teams/:id/repos/:owner/:repo", ""},
{"GET", "/user/teams", ""},
{GET, "/user/teams", ""},
// Pull Requests
{"GET", "/repos/:owner/:repo/pulls", ""},
{"GET", "/repos/:owner/:repo/pulls/:number", ""},
{GET, "/repos/:owner/:repo/pulls", ""},
{GET, "/repos/:owner/:repo/pulls/:number", ""},
{"POST", "/repos/:owner/:repo/pulls", ""},
//{"PATCH", "/repos/:owner/:repo/pulls/:number", ""},
{"GET", "/repos/:owner/:repo/pulls/:number/commits", ""},
{"GET", "/repos/:owner/:repo/pulls/:number/files", ""},
{"GET", "/repos/:owner/:repo/pulls/:number/merge", ""},
{GET, "/repos/:owner/:repo/pulls/:number/commits", ""},
{GET, "/repos/:owner/:repo/pulls/:number/files", ""},
{GET, "/repos/:owner/:repo/pulls/:number/merge", ""},
{"PUT", "/repos/:owner/:repo/pulls/:number/merge", ""},
{"GET", "/repos/:owner/:repo/pulls/:number/comments", ""},
//{"GET", "/repos/:owner/:repo/pulls/comments", ""},
//{"GET", "/repos/:owner/:repo/pulls/comments/:number", ""},
{GET, "/repos/:owner/:repo/pulls/:number/comments", ""},
//{GET, "/repos/:owner/:repo/pulls/comments", ""},
//{GET, "/repos/:owner/:repo/pulls/comments/:number", ""},
{"PUT", "/repos/:owner/:repo/pulls/:number/comments", ""},
//{"PATCH", "/repos/:owner/:repo/pulls/comments/:number", ""},
//{"DELETE", "/repos/:owner/:repo/pulls/comments/:number", ""},
// Repositories
{"GET", "/user/repos", ""},
{"GET", "/users/:user/repos", ""},
{"GET", "/orgs/:org/repos", ""},
{"GET", "/repositories", ""},
{GET, "/user/repos", ""},
{GET, "/users/:user/repos", ""},
{GET, "/orgs/:org/repos", ""},
{GET, "/repositories", ""},
{"POST", "/user/repos", ""},
{"POST", "/orgs/:org/repos", ""},
{"GET", "/repos/:owner/:repo", ""},
{GET, "/repos/:owner/:repo", ""},
//{"PATCH", "/repos/:owner/:repo", ""},
{"GET", "/repos/:owner/:repo/contributors", ""},
{"GET", "/repos/:owner/:repo/languages", ""},
{"GET", "/repos/:owner/:repo/teams", ""},
{"GET", "/repos/:owner/:repo/tags", ""},
{"GET", "/repos/:owner/:repo/branches", ""},
{"GET", "/repos/:owner/:repo/branches/:branch", ""},
{GET, "/repos/:owner/:repo/contributors", ""},
{GET, "/repos/:owner/:repo/languages", ""},
{GET, "/repos/:owner/:repo/teams", ""},
{GET, "/repos/:owner/:repo/tags", ""},
{GET, "/repos/:owner/:repo/branches", ""},
{GET, "/repos/:owner/:repo/branches/:branch", ""},
{"DELETE", "/repos/:owner/:repo", ""},
{"GET", "/repos/:owner/:repo/collaborators", ""},
{"GET", "/repos/:owner/:repo/collaborators/:user", ""},
{GET, "/repos/:owner/:repo/collaborators", ""},
{GET, "/repos/:owner/:repo/collaborators/:user", ""},
{"PUT", "/repos/:owner/:repo/collaborators/:user", ""},
{"DELETE", "/repos/:owner/:repo/collaborators/:user", ""},
{"GET", "/repos/:owner/:repo/comments", ""},
{"GET", "/repos/:owner/:repo/commits/:sha/comments", ""},
{GET, "/repos/:owner/:repo/comments", ""},
{GET, "/repos/:owner/:repo/commits/:sha/comments", ""},
{"POST", "/repos/:owner/:repo/commits/:sha/comments", ""},
{"GET", "/repos/:owner/:repo/comments/:id", ""},
{GET, "/repos/:owner/:repo/comments/:id", ""},
//{"PATCH", "/repos/:owner/:repo/comments/:id", ""},
{"DELETE", "/repos/:owner/:repo/comments/:id", ""},
{"GET", "/repos/:owner/:repo/commits", ""},
{"GET", "/repos/:owner/:repo/commits/:sha", ""},
{"GET", "/repos/:owner/:repo/readme", ""},
//{"GET", "/repos/:owner/:repo/contents/*path", ""},
{GET, "/repos/:owner/:repo/commits", ""},
{GET, "/repos/:owner/:repo/commits/:sha", ""},
{GET, "/repos/:owner/:repo/readme", ""},
//{GET, "/repos/:owner/:repo/contents/*path", ""},
//{"PUT", "/repos/:owner/:repo/contents/*path", ""},
//{"DELETE", "/repos/:owner/:repo/contents/*path", ""},
//{"GET", "/repos/:owner/:repo/:archive_format/:ref", ""},
{"GET", "/repos/:owner/:repo/keys", ""},
{"GET", "/repos/:owner/:repo/keys/:id", ""},
//{GET, "/repos/:owner/:repo/:archive_format/:ref", ""},
{GET, "/repos/:owner/:repo/keys", ""},
{GET, "/repos/:owner/:repo/keys/:id", ""},
{"POST", "/repos/:owner/:repo/keys", ""},
//{"PATCH", "/repos/:owner/:repo/keys/:id", ""},
{"DELETE", "/repos/:owner/:repo/keys/:id", ""},
{"GET", "/repos/:owner/:repo/downloads", ""},
{"GET", "/repos/:owner/:repo/downloads/:id", ""},
{GET, "/repos/:owner/:repo/downloads", ""},
{GET, "/repos/:owner/:repo/downloads/:id", ""},
{"DELETE", "/repos/:owner/:repo/downloads/:id", ""},
{"GET", "/repos/:owner/:repo/forks", ""},
{GET, "/repos/:owner/:repo/forks", ""},
{"POST", "/repos/:owner/:repo/forks", ""},
{"GET", "/repos/:owner/:repo/hooks", ""},
{"GET", "/repos/:owner/:repo/hooks/:id", ""},
{GET, "/repos/:owner/:repo/hooks", ""},
{GET, "/repos/:owner/:repo/hooks/:id", ""},
{"POST", "/repos/:owner/:repo/hooks", ""},
//{"PATCH", "/repos/:owner/:repo/hooks/:id", ""},
{"POST", "/repos/:owner/:repo/hooks/:id/tests", ""},
{"DELETE", "/repos/:owner/:repo/hooks/:id", ""},
{"POST", "/repos/:owner/:repo/merges", ""},
{"GET", "/repos/:owner/:repo/releases", ""},
{"GET", "/repos/:owner/:repo/releases/:id", ""},
{GET, "/repos/:owner/:repo/releases", ""},
{GET, "/repos/:owner/:repo/releases/:id", ""},
{"POST", "/repos/:owner/:repo/releases", ""},
//{"PATCH", "/repos/:owner/:repo/releases/:id", ""},
{"DELETE", "/repos/:owner/:repo/releases/:id", ""},
{"GET", "/repos/:owner/:repo/releases/:id/assets", ""},
{"GET", "/repos/:owner/:repo/stats/contributors", ""},
{"GET", "/repos/:owner/:repo/stats/commit_activity", ""},
{"GET", "/repos/:owner/:repo/stats/code_frequency", ""},
{"GET", "/repos/:owner/:repo/stats/participation", ""},
{"GET", "/repos/:owner/:repo/stats/punch_card", ""},
{"GET", "/repos/:owner/:repo/statuses/:ref", ""},
{GET, "/repos/:owner/:repo/releases/:id/assets", ""},
{GET, "/repos/:owner/:repo/stats/contributors", ""},
{GET, "/repos/:owner/:repo/stats/commit_activity", ""},
{GET, "/repos/:owner/:repo/stats/code_frequency", ""},
{GET, "/repos/:owner/:repo/stats/participation", ""},
{GET, "/repos/:owner/:repo/stats/punch_card", ""},
{GET, "/repos/:owner/:repo/statuses/:ref", ""},
{"POST", "/repos/:owner/:repo/statuses/:ref", ""},
// Search
{"GET", "/search/repositories", ""},
{"GET", "/search/code", ""},
{"GET", "/search/issues", ""},
{"GET", "/search/users", ""},
{"GET", "/legacy/issues/search/:owner/:repository/:state/:keyword", ""},
{"GET", "/legacy/repos/search/:keyword", ""},
{"GET", "/legacy/user/search/:keyword", ""},
{"GET", "/legacy/user/email/:email", ""},
{GET, "/search/repositories", ""},
{GET, "/search/code", ""},
{GET, "/search/issues", ""},
{GET, "/search/users", ""},
{GET, "/legacy/issues/search/:owner/:repository/:state/:keyword", ""},
{GET, "/legacy/repos/search/:keyword", ""},
{GET, "/legacy/user/search/:keyword", ""},
{GET, "/legacy/user/email/:email", ""},
// Users
{"GET", "/users/:user", ""},
{"GET", "/user", ""},
{GET, "/users/:user", ""},
{GET, "/user", ""},
//{"PATCH", "/user", ""},
{"GET", "/users", ""},
{"GET", "/user/emails", ""},
{GET, "/users", ""},
{GET, "/user/emails", ""},
{"POST", "/user/emails", ""},
{"DELETE", "/user/emails", ""},
{"GET", "/users/:user/followers", ""},
{"GET", "/user/followers", ""},
{"GET", "/users/:user/following", ""},
{"GET", "/user/following", ""},
{"GET", "/user/following/:user", ""},
{"GET", "/users/:user/following/:target_user", ""},
{GET, "/users/:user/followers", ""},
{GET, "/user/followers", ""},
{GET, "/users/:user/following", ""},
{GET, "/user/following", ""},
{GET, "/user/following/:user", ""},
{GET, "/users/:user/following/:target_user", ""},
{"PUT", "/user/following/:user", ""},
{"DELETE", "/user/following/:user", ""},
{"GET", "/users/:user/keys", ""},
{"GET", "/user/keys", ""},
{"GET", "/user/keys/:id", ""},
{GET, "/users/:user/keys", ""},
{GET, "/user/keys", ""},
{GET, "/user/keys/:id", ""},
{"POST", "/user/keys", ""},
//{"PATCH", "/user/keys/:id", ""},
{"DELETE", "/user/keys/:id", ""},
@ -552,6 +552,38 @@ func TestRouterParamNames(t *testing.T) {
assert.Equal(t, "1", c.Param("fid"))
}
// Issue #623
func TestRouterStaticDynamicConflict(t *testing.T) {
e := New()
r := e.router
c := e.NewContext(nil, nil)
r.Add(GET, "/dictionary/skills", func(c Context) error {
c.Set("a", 1)
return nil
}, e)
r.Add(GET, "/dictionary/:name", func(c Context) error {
c.Set("b", 2)
return nil
}, e)
r.Add(GET, "/server", func(c Context) error {
c.Set("c", 3)
return nil
}, e)
r.Find(GET, "/dictionary/skills", c)
c.Handler()(c)
assert.Equal(t, 1, c.Get("a"))
c = e.NewContext(nil, nil)
r.Find(GET, "/dictionary/type", c)
c.Handler()(c)
assert.Equal(t, 2, c.Get("b"))
c = e.NewContext(nil, nil)
r.Find(GET, "/server", c)
c.Handler()(c)
assert.Equal(t, 3, c.Get("c"))
}
func TestRouterAPI(t *testing.T) {
e := New()
r := e.router