diff --git a/actions/base/routes.go b/actions/base/routes.go index 742093a16..f0d57558c 100644 --- a/actions/base/routes.go +++ b/actions/base/routes.go @@ -16,7 +16,6 @@ type Action struct { // RegisterRoutes register all the package specific routes func RegisterRoutes(router *apirouter.Router, appConfig *config.AppConfig, services *config.AppServices) { - // Load the actions and set the services action := &Action{actions.Action{AppConfig: appConfig, Services: services}} @@ -32,15 +31,15 @@ func RegisterRoutes(router *apirouter.Router, appConfig *config.AppConfig, servi // Debugging (shows all the Go profiler information) if action.AppConfig.DebugProfiling { - router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/", pprof.Index) - router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/cmdline", pprof.Cmdline) - router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/profile", pprof.Profile) - router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/symbol", pprof.Symbol) - router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/trace", pprof.Trace) - router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/goroutine", pprof.Handler("goroutine")) - router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/heap", pprof.Handler("heap")) - router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/threadcreate", pprof.Handler("threadcreate")) - router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/block", pprof.Handler("block")) + router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/", pprof.Index) + router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/cmdline", pprof.Cmdline) + router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/profile", pprof.Profile) + router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/symbol", pprof.Symbol) + router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/trace", pprof.Trace) + router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/goroutine", pprof.Handler("goroutine")) + router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/heap", pprof.Handler("heap")) + router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/threadcreate", pprof.Handler("threadcreate")) + router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/block", pprof.Handler("block")) } // Set the 404 handler (any request not detected) diff --git a/actions/base/routes_test.go b/actions/base/routes_test.go index b4f22e0e5..0a2b7470f 100644 --- a/actions/base/routes_test.go +++ b/actions/base/routes_test.go @@ -11,7 +11,6 @@ import ( // TestBaseRegisterRoutes will test routes func (ts *TestSuite) TestBaseRegisterRoutes() { ts.T().Run("test routes", func(t *testing.T) { - // index handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodGet, "/") assert.NotNil(t, handle) @@ -38,32 +37,31 @@ func (ts *TestSuite) TestBaseRegisterRoutes() { }) ts.T().Run("test debug profile routes", func(t *testing.T) { - - handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/") + handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/cmdline") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/cmdline") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/profile") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/profile") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/symbol") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/symbol") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/trace") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/trace") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/goroutine") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/goroutine") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/heap") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/heap") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/threadcreate") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/threadcreate") assert.NotNil(t, handle) - handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/block") + handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/block") assert.NotNil(t, handle) }) }