Unverified Commit fc4441a4 authored by Ximo Guanter's avatar Ximo Guanter Committed by GitHub
Browse files

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


Signed-off-by: default avatarXimo Guanter <ximo.guanter@gmail.com>
Co-authored-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
parent 246e3e0a
...@@ -44,6 +44,6 @@ schema = schemathesis.from_pytest_fixture("get_schema") ...@@ -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)
...@@ -390,10 +390,10 @@ def engine_client(request: Request) -> EngineClient: ...@@ -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): ...@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment