From 5e8450ad580bc91b0e4187663bad6af3a87abc3d Mon Sep 17 00:00:00 2001 From: dylanyang Date: Mon, 4 Mar 2024 22:24:57 +0800 Subject: [PATCH] fix healty --- rpc_server/api/health.go | 10 +++++++++- rpc_server/routers/routers_map.go | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rpc_server/api/health.go b/rpc_server/api/health.go index a53f1b21..a2ec82ab 100644 --- a/rpc_server/api/health.go +++ b/rpc_server/api/health.go @@ -7,7 +7,15 @@ import ( "time" ) -func Health(c *gin.Context) { +// Healthz +// @Tags Healthz +// @Description Get Healthz +// @Accept json +// @Product json +// @Param +// @Router /api/health [post,get,put,delete] +// @Success 200 +func Healthz(c *gin.Context) { response := models.GetResponse() response.WithDataSuccess(c, gin.H{ "hello": "Eth Paymaster", diff --git a/rpc_server/routers/routers_map.go b/rpc_server/routers/routers_map.go index 7888eb35..08d02905 100644 --- a/rpc_server/routers/routers_map.go +++ b/rpc_server/routers/routers_map.go @@ -15,7 +15,7 @@ func init() { PrivateRouterMaps = append(PrivateRouterMaps, RouterMap{string(GetSupportStrategy), []RestfulMethod{GET}, v1.GetSupportStrategy}) PrivateRouterMaps = append(PrivateRouterMaps, RouterMap{string(GetSupportEntrypoint), []RestfulMethod{GET}, v1.GetSupportEntrypoint}) PublicRouterMaps = append(PublicRouterMaps, RouterMap{string(Auth), []RestfulMethod{POST}, api.Auth}) - PublicRouterMaps = append(PublicRouterMaps, RouterMap{string(Health), []RestfulMethod{GET}, api.Health}) + PublicRouterMaps = append(PublicRouterMaps, RouterMap{string(Healthz), []RestfulMethod{GET, POST, PUT, DELETE}, api.Healthz}) } type Path string @@ -25,5 +25,5 @@ const ( GetSupportStrategy Path = "api/v1/get-support-strategy" GetSupportEntrypoint Path = "api/v1/get-support-entrypoint" Auth Path = "api/auth" - Health Path = "api/health" + Healthz Path = "api/healthz" )