add healthcheck

This commit is contained in:
Thephaseless 2024-10-21 13:34:07 +00:00
parent 5a40851c22
commit 4e6fbe0e95
2 changed files with 17 additions and 0 deletions

12
main.py
View File

@ -24,6 +24,18 @@ def read_root():
return RedirectResponse(url="/docs", status_code=301)
@app.get("/health")
async def health_check():
"""Health check endpoint."""
logger.info("Health check")
browser = await new_browser()
await browser.grant_all_permissions()
page = await browser.get("https://google.com")
await page.bring_to_front()
browser.stop()
return {"status": "ok"}
@app.post("/v1")
async def read_item(request: LinkRequest):
"""Handle POST requests."""

View File

@ -35,3 +35,8 @@ def test_bypass(website: str):
)
assert response.status_code == HTTPStatus.OK
def test_health_check():
response = client.get("/health")
assert response.status_code == HTTPStatus.OK