@@ -26,25 +26,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine {
2626
2727// NewRouter add routes to existing gin engine.
2828func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
29- for _, route := range getRoutes(handleFunctions) {
30- if route.HandlerFunc == nil {
31- route.HandlerFunc = DefaultHandleFunc
32- }
33- switch route.Method {
34- case http.MethodGet:
35- router.GET(route.Pattern, route.HandlerFunc)
36- case http.MethodPost:
37- router.POST(route.Pattern, route.HandlerFunc)
38- case http.MethodPut:
39- router.PUT(route.Pattern, route.HandlerFunc)
40- case http.MethodPatch:
41- router.PATCH(route.Pattern, route.HandlerFunc)
42- case http.MethodDelete:
43- router.DELETE(route.Pattern, route.HandlerFunc)
44- }
45- }
29+ for _, route := range getRoutes(handleFunctions) {
30+ if route.HandlerFunc == nil {
31+ route.HandlerFunc = DefaultHandleFunc
32+ }
33+ switch route.Method {
34+ case http.MethodGet:
35+ router.GET(route.Pattern, route.HandlerFunc)
36+ case http.MethodPost:
37+ router.POST(route.Pattern, route.HandlerFunc)
38+ case http.MethodPut:
39+ router.PUT(route.Pattern, route.HandlerFunc)
40+ case http.MethodPatch:
41+ router.PATCH(route.Pattern, route.HandlerFunc)
42+ case http.MethodDelete:
43+ router.DELETE(route.Pattern, route.HandlerFunc)
44+ }
45+ }
4646
47- return router
47+ return router
4848}
4949
5050// Default handler for not yet implemented routes
0 commit comments