mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(proxy) - Auth fix, ensure re-using safe request body for checking model
field (#7222)
* litellm fix auth check * fix _read_request_body * test_auth_with_form_data_and_model * fix auth check * fix _read_request_body * fix _safe_get_request_headers
This commit is contained in:
parent
ec36353b41
commit
9432812c90
3 changed files with 87 additions and 16 deletions
|
@ -899,12 +899,10 @@ async def user_api_key_auth( # noqa: PLR0915
|
|||
# the validation will occur when checking the team has access to this model
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
data = await request.json()
|
||||
except json.JSONDecodeError:
|
||||
data = {} # Provide a default value, such as an empty dictionary
|
||||
model = data.get("model", None)
|
||||
fallback_models: Optional[List[str]] = data.get("fallbacks", None)
|
||||
model = request_data.get("model", None)
|
||||
fallback_models: Optional[List[str]] = request_data.get(
|
||||
"fallbacks", None
|
||||
)
|
||||
|
||||
if model is not None:
|
||||
await can_key_call_model(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue