From 2927811c1944b45a21bb7e063c6b2c14db053e6a Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Sat, 17 Feb 2024 19:17:33 -0800 Subject: [PATCH] (fix) testing fix --- litellm/proxy/utils.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 51e7c3c15c6..1cdacf76fb7 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -1379,19 +1379,22 @@ async def _read_request_body(request): """ import ast, json - request_data = {} - if request is None: - return request_data - body = await request.body() - - if body == b"" or body is None: - return request_data - body_str = body.decode() try: - request_data = ast.literal_eval(body_str) + request_data = {} + if request is None: + return request_data + body = await request.body() + + if body == b"" or body is None: + return request_data + body_str = body.decode() + try: + request_data = ast.literal_eval(body_str) + except: + request_data = json.loads(body_str) + return request_data except: - request_data = json.loads(body_str) - return request_data + return {} def _is_valid_team_configs(team_id=None, team_config=None, request_data=None):