Skip to content

Commit

Permalink
feat: add /healthz endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mjugl committed Feb 22, 2024
1 parent 8de419a commit 7a0bc99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions project/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ async def lifespan(app: FastAPI):

app = FastAPI(lifespan=lifespan)


@app.get("/healthz")
async def do_healthcheck():
return {"status": "ok"}


app.include_router(
upload.router,
prefix="/upload",
Expand Down
5 changes: 5 additions & 0 deletions tests/test_health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_200_healthcheck(test_client):
r = test_client.get("/healthz")

assert r.status_code == 200
assert r.json() == {"status": "ok"}

0 comments on commit 7a0bc99

Please sign in to comment.