mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-13 23:31:19 +08:00
Update routergroup.go
This commit is contained in:
parent
b57163a0e4
commit
b00d3ec5b6
@ -141,6 +141,14 @@ func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) IRo
|
|||||||
return group.handle(http.MethodHead, relativePath, handlers)
|
return group.handle(http.MethodHead, relativePath, handlers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Customize almost same with router.Handle but no HTTP method limited.
|
||||||
|
func (group *RouterGroup) Customize(method string,relativePath string, handlers ...HandlerFunc) IRoutes {
|
||||||
|
matched,err := regexp.MatchString("^[A-Za-z]+$",method)
|
||||||
|
assert1(matched == true, "HTTP method can only be letters")
|
||||||
|
assert1(err == nil, "HTTP method is wrong")
|
||||||
|
return group.handle(method, relativePath, handlers)
|
||||||
|
}
|
||||||
|
|
||||||
// Any registers a route that matches all the HTTP methods.
|
// Any registers a route that matches all the HTTP methods.
|
||||||
// GET, POST, PUT, PATCH, HEAD, OPTIONS, DELETE, CONNECT, TRACE.
|
// GET, POST, PUT, PATCH, HEAD, OPTIONS, DELETE, CONNECT, TRACE.
|
||||||
func (group *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) IRoutes {
|
func (group *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) IRoutes {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user