完善 RequestHandler 逻辑
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
@ -28,8 +29,21 @@ func Group(router *gin.Engine, routerPrefix string, middlewareList []gin.Handler
|
||||
method := strings.ToUpper(itemUriCfg.Method)
|
||||
switch method {
|
||||
case http.MethodGet:
|
||||
g.HEAD(itemUriCfg.Path)
|
||||
|
||||
g.GET(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodHead:
|
||||
g.HEAD(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodPost:
|
||||
g.POST(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodPut:
|
||||
g.PUT(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodPatch:
|
||||
g.PATCH(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodDelete:
|
||||
g.DELETE(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodOptions:
|
||||
g.OPTIONS(itemUriCfg.Path, RequestHandler(itemUriCfg))
|
||||
case http.MethodTrace:
|
||||
return errors.New(`method Trace is not supported`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user