diff --git a/x/server/server.go b/x/server/server.go index d5abb0a62..8a268f976 100644 --- a/x/server/server.go +++ b/x/server/server.go @@ -95,7 +95,7 @@ func (s *Server) routes(mux *chi.Mux) { auth.Post("/_search_analyze", httpe.ToHandler(s.notImplemented()).ServeHTTP) auth.Get("/_utils", httpe.ToHandler(s.notImplemented()).ServeHTTP) auth.Get("/_utils/", httpe.ToHandler(s.notImplemented()).ServeHTTP) - mux.Get("/_up", httpe.ToHandler(s.notImplemented()).ServeHTTP) + mux.Get("/_up", httpe.ToHandler(s.up()).ServeHTTP) auth.Get("/_uuids", httpe.ToHandler(s.notImplemented()).ServeHTTP) mux.Get("/favicon.ico", httpe.ToHandler(s.notImplemented()).ServeHTTP) auth.Get("/_reshard", httpe.ToHandler(s.notImplemented()).ServeHTTP) @@ -290,3 +290,11 @@ func (s *Server) dbExists() httpe.HandlerWithError { return nil }) } + +func (s *Server) up() httpe.HandlerWithError { + return httpe.HandlerWithErrorFunc(func(w http.ResponseWriter, r *http.Request) error { + return serveJSON(w, http.StatusOK, map[string]interface{}{ + "status": "ok", + }) + }) +} diff --git a/x/server/server_test.go b/x/server/server_test.go index e8d226ad2..d932763aa 100644 --- a/x/server/server_test.go +++ b/x/server/server_test.go @@ -222,6 +222,15 @@ func TestServer(t *testing.T) { "ok": true, }, }, + { + name: "_up", + method: http.MethodGet, + path: "/_up", + wantStatus: http.StatusOK, + wantJSON: map[string]interface{}{ + "status": "ok", + }, + }, } for _, tt := range tests {