Add missing content type headers to /ping and /health (#17036) (#17786)

Signed-off-by: Ximo Guanter <ximo.guanter@gmail.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Ximo Guanter 2025-05-10 08:13:32 +02:00 committed by GitHub
parent 246e3e0a36
commit fc4441a4ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -44,6 +44,6 @@ schema = schemathesis.from_pytest_fixture("get_schema")
@schema.parametrize() @schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"}) @schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case): def test_openapi_stateless(case: schemathesis.Case):
#No need to verify SSL certificate for localhost #No need to verify SSL certificate for localhost
await case.call_and_validate(verify=False) case.call_and_validate(verify=False)

View File

@ -390,10 +390,10 @@ def engine_client(request: Request) -> EngineClient:
@router.get("/health") @router.get("/health")
async def health(raw_request: Request) -> Response: async def health(raw_request: Request) -> JSONResponse:
"""Health check.""" """Health check."""
await engine_client(raw_request).check_health() await engine_client(raw_request).check_health()
return Response(status_code=200) return JSONResponse(content={}, status_code=200)
@router.get("/load") @router.get("/load")
@ -415,7 +415,7 @@ async def get_server_load_metrics(request: Request):
@router.api_route("/ping", methods=["GET", "POST"]) @router.api_route("/ping", methods=["GET", "POST"])
async def ping(raw_request: Request) -> Response: async def ping(raw_request: Request) -> JSONResponse:
"""Ping check. Endpoint required for SageMaker""" """Ping check. Endpoint required for SageMaker"""
return await health(raw_request) return await health(raw_request)