feat(rename): rename the api_key

This commit is contained in:
YuehuCao 2025-09-12 16:05:19 +08:00
parent c5cfb5a424
commit 6630d20c13

View File

@ -53,7 +53,7 @@ class NotificationServiceMiddleware:
return
# 2. Extract API Key from request header
api_key = request.headers.get("X-API-Key")
api_key = request.headers.get("X-API-KEY")
# if the API_KEY field is empty, the request can be processed directly without validation.
# for compatibility
if not api_key or api_key == "":
@ -106,7 +106,7 @@ class NotificationServiceMiddleware:
await self.app(scope, receive, send_wrapper)
# 7. Record usage log after request processing
if validation_result and response_captured:
if response_captured:
await self._log_usage(validation_result, request, response_captured, start_time)
except Exception as e: