mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix(proxy): read request method defensively for mock and scopeless requests
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
ab95b8066e
commit
cedee4800a
1 changed files with 5 additions and 1 deletions
|
|
@ -1362,11 +1362,15 @@ async def _user_api_key_auth_builder(
|
|||
_lockout_reason: Final = insecure_master_key_reason(
|
||||
master_key, alternative_auth_enabled=alternative_auth_enabled(general_settings)
|
||||
)
|
||||
try:
|
||||
_request_method: Final = request.method
|
||||
except (KeyError, AttributeError):
|
||||
_request_method = ""
|
||||
if (
|
||||
_lockout_reason is not None
|
||||
and master_key_lockout_action(
|
||||
route=route,
|
||||
method=request.scope.get("method") or "",
|
||||
method=_request_method if isinstance(_request_method, str) else "",
|
||||
reason=_lockout_reason,
|
||||
stored_credentials_present=stored_credentials_present(),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue