From a4b7a07bff1d5780d0fe1c00ff321843e2380b8d Mon Sep 17 00:00:00 2001 From: Sung Won Cho Date: Sun, 24 Apr 2022 11:32:04 +1000 Subject: [PATCH] Preserve backwards compatibility of health endpoint (#593) --- pkg/server/controllers/health_test.go | 2 +- pkg/server/controllers/routes.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/server/controllers/health_test.go b/pkg/server/controllers/health_test.go index 9e5b53b8..2a6254e8 100644 --- a/pkg/server/controllers/health_test.go +++ b/pkg/server/controllers/health_test.go @@ -39,7 +39,7 @@ func TestHealth(t *testing.T) { defer server.Close() // Execute - req := testutils.MakeReq(server.URL, "GET", "/api/health", "") + req := testutils.MakeReq(server.URL, "GET", "/health", "") res := testutils.HTTPDo(t, req) // Test diff --git a/pkg/server/controllers/routes.go b/pkg/server/controllers/routes.go index af76bf76..8769fa0d 100644 --- a/pkg/server/controllers/routes.go +++ b/pkg/server/controllers/routes.go @@ -43,6 +43,8 @@ func NewWebRoutes(a *app.App, c *Controllers) []Route { {"GET", "/verify-email/{token}", mw.Auth(a, c.Users.VerifyEmail, redirectGuest), true}, {"PATCH", "/account/profile", mw.Auth(a, c.Users.ProfileUpdate, nil), true}, {"PATCH", "/account/password", mw.Auth(a, c.Users.PasswordUpdate, nil), true}, + + {"GET", "/health", c.Health.Index, true}, } if !a.Config.DisableRegistration { @@ -59,9 +61,6 @@ func NewAPIRoutes(a *app.App, c *Controllers) []Route { proOnly := mw.AuthParams{ProOnly: true} return []Route{ - // internal - {"GET", "/health", c.Health.Index, true}, - // v3 {"GET", "/v3/sync/fragment", mw.Cors(mw.Auth(a, c.Sync.GetSyncFragment, &proOnly)), false}, {"GET", "/v3/sync/state", mw.Cors(mw.Auth(a, c.Sync.GetSyncState, &proOnly)), false},