Skip to content

Commit 59e1eca

Browse files
committed
Test as optional value
1 parent 06ee735 commit 59e1eca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

code/function/fastapp/health/validate_request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
async def verify_health_auth_header(
13-
x_ms_auth_internal_token: Annotated[str, Header()]
13+
x_ms_auth_internal_token: Annotated[str, Header()] = ""
1414
) -> bool:
1515
"""Returns true if SHA256 of header_value matches WEBSITE_AUTH_ENCRYPTION_KEY.
1616
Documentation: https://learn.microsoft.com/en-us/azure/app-service/monitor-instances-health-check?tabs=python#authentication-and-security
@@ -22,8 +22,8 @@ async def verify_health_auth_header(
2222
logger.info(f"Encryption key: '{settings.WEBSITE_AUTH_ENCRYPTION_KEY}'")
2323
website_auth_encryption_key = settings.WEBSITE_AUTH_ENCRYPTION_KEY
2424
hash = base64.b64encode(
25-
sha256(website_auth_encryption_key.encode("utf-8")).digest()
26-
).decode("utf-8")
25+
sha256(website_auth_encryption_key.encode('utf-8')).digest()
26+
).decode('utf-8')
2727
# if hash != x_ms_auth_internal_token:
2828
# raise HTTPException(
2929
# status_code=400, detail="x-ms-auth-internal-token is invalid"

0 commit comments

Comments
 (0)