From 626b74bd4d8b58525f1972ccee2a216b32013638 Mon Sep 17 00:00:00 2001 From: KazeNoYumeX Date: Fri, 8 Mar 2024 22:17:33 +0800 Subject: [PATCH] Feat: Modified the Heartbeat API to integrate with the GAAS --- Backend/service/delivery/http/v1/heartbeat_handler.go | 4 ++-- Backend/tests/e2e/hearbeat_api_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Backend/service/delivery/http/v1/heartbeat_handler.go b/Backend/service/delivery/http/v1/heartbeat_handler.go index a3a07fb..38e0568 100644 --- a/Backend/service/delivery/http/v1/heartbeat_handler.go +++ b/Backend/service/delivery/http/v1/heartbeat_handler.go @@ -13,7 +13,7 @@ type HeartbeatHandler struct { func RegisterHeartbeatHandler(opts *HeartbeatHandler) { handler := &HeartbeatHandler{} - opts.Engine.GET("/api/v1/heartbeat", handler.Heartbeat) + opts.Engine.GET("/api/v1/health", handler.Heartbeat) } // Heartbeat godoc @@ -23,7 +23,7 @@ func RegisterHeartbeatHandler(opts *HeartbeatHandler) { // @Accept json // @Produce json // @Success 204 -// @Router /api/v1/heartbeat [GET] +// @Router /api/v1/health [GET] func (g *HeartbeatHandler) Heartbeat(c *gin.Context) { c.JSON(http.StatusNoContent, http.NoBody) } diff --git a/Backend/tests/e2e/hearbeat_api_test.go b/Backend/tests/e2e/hearbeat_api_test.go index 90c660d..05ffa0a 100644 --- a/Backend/tests/e2e/hearbeat_api_test.go +++ b/Backend/tests/e2e/hearbeat_api_test.go @@ -15,12 +15,12 @@ func TestHeartbeatEndpoint(t *testing.T) { router := gin.Default() // Set up the heartbeat endpoint - router.GET("/api/v1/heartbeat", func(c *gin.Context) { + router.GET("/api/v1/health", func(c *gin.Context) { c.Status(http.StatusNoContent) }) // Prepare a new HTTP request - req, _ := http.NewRequest("GET", "/api/v1/heartbeat", nil) + req, _ := http.NewRequest("GET", "/api/v1/health", nil) // Create a response recorder res := httptest.NewRecorder()