Skip to content

Commit

Permalink
fix(healthx): separate version and health routes
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Mar 19, 2021
1 parent 30d25bb commit d80f3e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions healthx/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ func NewHandler(
}
}

// SetRoutes registers this handler's routes.
func (h *Handler) SetRoutes(r *httprouter.Router, shareErrors bool) {
// SetHealthRoutes registers this handler's routes for health checking.
func (h *Handler) SetHealthRoutes(r *httprouter.Router, shareErrors bool) {
r.GET(AliveCheckPath, h.Alive)
r.GET(ReadyCheckPath, h.Ready(shareErrors))
}

// SetHealthRoutes registers this handler's routes for health checking.
func (h *Handler) SetVersionRoutes(r *httprouter.Router) {
r.GET(VersionPath, h.Version)
}

Expand Down
3 changes: 2 additions & 1 deletion healthx/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ func TestHealth(t *testing.T) {
},
}
router := httprouter.New()
handler.SetRoutes(router, true)
handler.SetHealthRoutes(router, true)
handler.SetVersionRoutes(router)
ts := httptest.NewServer(router)
c := http.DefaultClient

Expand Down

0 comments on commit d80f3e1

Please sign in to comment.