Skip to content

Commit

Permalink
removed deprecated functions group.go
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Oct 13, 2016
1 parent 2eb87f8 commit d5b3fef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 62 deletions.
6 changes: 3 additions & 3 deletions echo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func TestEchoURL(t *testing.T) {
e.GET("/static/file", static)
e.GET("/users/:id", getUser)
g := e.Group("/group")
g.Get("/users/:uid/files/:fid", getFile)
g.GET("/users/:uid/files/:fid", getFile)

assert.Equal(t, "/static/file", e.URL(static))
assert.Equal(t, "/users/:id", e.URL(getUser))
Expand Down Expand Up @@ -344,7 +344,7 @@ func TestEchoGroup(t *testing.T) {
return next(c)
}
})
g1.Get("", h)
g1.GET("", h)

// Nested groups with middleware
g2 := e.Group("/group2")
Expand All @@ -361,7 +361,7 @@ func TestEchoGroup(t *testing.T) {
return next(c)
}
})
g3.Get("", h)
g3.GET("", h)

request(GET, "/users", e)
assert.Equal(t, "0", buf.String())
Expand Down
50 changes: 0 additions & 50 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,103 +16,53 @@ 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.
func (g *Group) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(CONNECT, path, h, m...)
}

// Connect is deprecated, use `CONNECT()` instead.
func (g *Group) Connect(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(CONNECT, path, h, m...)
}

// DELETE implements `Echo#DELETE()` for sub-routes within the Group.
func (g *Group) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(DELETE, path, h, m...)
}

// Delete is deprecated, use `DELETE()` instead.
func (g *Group) Delete(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(DELETE, path, h, m...)
}

// GET implements `Echo#GET()` for sub-routes within the Group.
func (g *Group) GET(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(GET, path, h, m...)
}

// Get is deprecated, use `GET()` instead.
func (g *Group) Get(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(GET, path, h, m...)
}

// HEAD implements `Echo#HEAD()` for sub-routes within the Group.
func (g *Group) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(HEAD, path, h, m...)
}

// Head is deprecated, use `HEAD()` instead.
func (g *Group) Head(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(HEAD, path, h, m...)
}

// OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group.
func (g *Group) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(OPTIONS, path, h, m...)
}

// Options is deprecated, use `OPTIONS()` instead.
func (g *Group) Options(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(OPTIONS, path, h, m...)
}

// PATCH implements `Echo#PATCH()` for sub-routes within the Group.
func (g *Group) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(PATCH, path, h, m...)
}

// Patch is deprecated, use `PATCH()` instead.
func (g *Group) Patch(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(PATCH, path, h, m...)
}

// POST implements `Echo#POST()` for sub-routes within the Group.
func (g *Group) POST(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(POST, path, h, m...)
}

// Post is deprecated, use `POST()` instead.
func (g *Group) Post(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(POST, path, h, m...)
}

// PUT implements `Echo#PUT()` for sub-routes within the Group.
func (g *Group) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(PUT, path, h, m...)
}

// Put is deprecated, use `PUT()` instead.
func (g *Group) Put(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(PUT, path, h, m...)
}

// TRACE implements `Echo#TRACE()` for sub-routes within the Group.
func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(TRACE, path, h, m...)
}

// Trace is deprecated, use `TRACE()` instead.
func (g *Group) Trace(path string, h HandlerFunc, m ...MiddlewareFunc) {
g.add(TRACE, path, h, m...)
}

// Any implements `Echo#Any()` for sub-routes within the Group.
func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) {
for _, m := range methods {
Expand Down
9 changes: 0 additions & 9 deletions group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,14 @@ func TestGroup(t *testing.T) {
g := New().Group("/group")
h := func(Context) error { return nil }
g.CONNECT("/", h)
g.Connect("/", h)
g.DELETE("/", h)
g.Delete("/", h)
g.GET("/", h)
g.Get("/", h)
g.HEAD("/", h)
g.Head("/", h)
g.OPTIONS("/", h)
g.Options("/", h)
g.PATCH("/", h)
g.Patch("/", h)
g.POST("/", h)
g.Post("/", h)
g.PUT("/", h)
g.Put("/", h)
g.TRACE("/", h)
g.Trace("/", h)
g.Any("/", h)
g.Match([]string{GET, POST}, "/", h)
g.Static("/static", "/tmp")
Expand Down

0 comments on commit d5b3fef

Please sign in to comment.