working commit
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ func pathCompiler(path string) (string, error) {
|
||||
}
|
||||
|
||||
const (
|
||||
defaultRegexp = `[a-zA-Z0-9_][\-\.a-zA-Z0-9_%%=:~]+`
|
||||
defaultRegexp = `[a-zA-Z0-9_][/\-\.a-zA-Z0-9_%%=:~]+`
|
||||
)
|
||||
|
||||
func convertRegexp(src []byte) []byte {
|
||||
|
||||
@@ -30,6 +30,10 @@ func (rout *Router) AddRoute(method, path string, handlerFunc HandlerFunc) {
|
||||
rout.routeHandler.AddRoute(method, path, handlerFunc)
|
||||
}
|
||||
|
||||
func (rout *Router) Head(path string, handlerFunc HandlerFunc) {
|
||||
rout.routeHandler.AddRoute("HEAD", path, handlerFunc)
|
||||
}
|
||||
|
||||
func (rout *Router) Get(path string, handlerFunc HandlerFunc) {
|
||||
rout.routeHandler.AddRoute("GET", path, handlerFunc)
|
||||
}
|
||||
@@ -38,6 +42,10 @@ func (rout *Router) Post(path string, handlerFunc HandlerFunc) {
|
||||
rout.routeHandler.AddRoute("POST", path, handlerFunc)
|
||||
}
|
||||
|
||||
func (rout *Router) Put(path string, handlerFunc HandlerFunc) {
|
||||
rout.routeHandler.AddRoute("PUT", path, handlerFunc)
|
||||
}
|
||||
|
||||
func (rout *Router) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
|
||||
rctx := NewContext(writer, req)
|
||||
rout.routeHandler.ServeHTTP(rctx)
|
||||
|
||||
Reference in New Issue
Block a user