Skip to content

Commit 881aa85

Browse files
committed
Add dependency to health endpoint
1 parent 014e144 commit 881aa85

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Any
22

3-
from fastapi import APIRouter
3+
from fastapi import APIRouter, Depends
4+
from fastapp.health.validate_request import verify_health_auth_header
45
from fastapp.models.heartbeat import HearbeatResult
56
from fastapp.utils import setup_logging
67

@@ -9,7 +10,12 @@
910
router = APIRouter()
1011

1112

12-
@router.get("/heartbeat", response_model=HearbeatResult, name="heartbeat")
13+
@router.get(
14+
"/heartbeat",
15+
response_model=HearbeatResult,
16+
name="heartbeat",
17+
dependencies=[Depends(verify_health_auth_header)],
18+
)
1319
async def get_hearbeat() -> Any:
1420
logger.info("Received Heartbeat Request")
1521
return HearbeatResult(isAlive=True)

0 commit comments

Comments
 (0)