Skip to content

Commit

Permalink
Merge pull request #125 from KazeNoYumeX/feature/refactor-heartbeat-test
Browse files Browse the repository at this point in the history
Feat: Modified the Heartbeat API to integrate with the GAAS
  • Loading branch information
linycken013127 authored Mar 15, 2024
2 parents 0ba681b + 626b74b commit 4c053c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Backend/service/delivery/http/v1/heartbeat_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions Backend/tests/e2e/hearbeat_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 4c053c0

Please sign in to comment.