File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -371,11 +371,13 @@ def register_core(self) -> None:
371371 def add_health_check (self ) -> None :
372372 """Add a health check."""
373373
374+ mgmt_router = APIRouter (prefix = self .app .state .router_prefix )
375+
374376 async def ping ():
375377 """Liveliness probe."""
376378 return {"message" : "PONG" }
377379
378- self . app . router .add_api_route (
380+ mgmt_router .add_api_route (
379381 name = "Ping" ,
380382 path = "/_mgmt/ping" ,
381383 response_model = Dict ,
@@ -389,10 +391,9 @@ async def ping():
389391 response_class = self .response_class ,
390392 methods = ["GET" ],
391393 endpoint = ping ,
392- tags = ["Liveliness/Readiness" ],
393394 )
394395
395- self . app . router .add_api_route (
396+ mgmt_router .add_api_route (
396397 name = "Health" ,
397398 path = "/_mgmt/health" ,
398399 response_model = Dict ,
@@ -406,8 +407,8 @@ async def ping():
406407 response_class = self .response_class ,
407408 methods = ["GET" ],
408409 endpoint = self .health_check ,
409- tags = ["Liveliness/Readiness" ],
410410 )
411+ self .app .include_router (mgmt_router , tags = ["Liveliness/Readiness" ])
411412
412413 def add_route_dependencies (
413414 self , scopes : List [Scope ], dependencies : List [Depends ]
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ def test_api_prefix(TestCoreClient, prefix):
3434 )
3535
3636 with TestClient (api .app , base_url = "http://stac.io" ) as client :
37+ ping = client .get (f"{ prefix } /_mgmt/ping" )
38+ assert ping .status_code == 200 , ping .json () == {"message" : "PONG" }
39+
3740 landing = client .get (f"{ prefix } /" )
3841 assert landing .status_code == 200 , landing .json ()
3942
You can’t perform that action at this time.
0 commit comments