Skip to content

Commit ba6d989

Browse files
author
Marvin Zhang
committed
fix(controllers/health): return after responding OK to avoid falling through; tidy imports
1 parent ec3dd2d commit ba6d989

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/controllers/health.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
package controllers
22

33
import (
4-
"github.com/gin-gonic/gin"
54
"net/http"
5+
6+
"github.com/gin-gonic/gin"
67
)
78

89
func GetHealthFn(healthFn func() bool) func(c *gin.Context) {
910
return func(c *gin.Context) {
1011
if healthFn() {
1112
_, _ = c.Writer.Write([]byte("ok"))
1213
c.AbortWithStatus(http.StatusOK)
14+
return
1315
}
1416
_, _ = c.Writer.Write([]byte("not ready"))
1517
c.AbortWithStatus(http.StatusServiceUnavailable)

0 commit comments

Comments
 (0)