From c94956268cfafe2bb975d517964d902c9c63957f Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 26 Nov 2024 23:30:33 -0800 Subject: [PATCH] fix JSONDecodeError --- litellm/proxy/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 46d554190..933db8a76 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -907,7 +907,11 @@ class ProxyLogging: parent_otel_span=parent_otel_span, token=_hash_token_if_needed(token=api_key), ) - request_data = await request.json() + try: + request_data = await request.json() + except json.JSONDecodeError: + # For GET requests or requests without a JSON body + request_data = {} await self._run_post_call_failure_hook_custom_loggers( original_exception=original_exception, request_data=request_data,