1
0
mirror of https://github.com/labstack/echo.git synced 2025-05-29 23:17:34 +02:00

removed deprecated functions group.go

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-10-13 13:51:37 -07:00
parent 2eb87f8036
commit d5b3fef5c9
3 changed files with 3 additions and 62 deletions

View File

@ -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))
@ -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")
@ -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())

View File

@ -16,11 +16,6 @@ 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.
@ -28,91 +23,46 @@ 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 {

View File

@ -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")