Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix _parse_request_data_by_content_type

Ishaan Jaffer6be5ad590237
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
index 89a93247ea8..669988d6835 100644
--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
@@ -942,10 +942,14 @@ async def _parse_request_data_by_content_type(
if "application/json" in content_type:
# ✅ Handle JSON
- body = await request.json()
- query_params_data = body.get("query_params")
- custom_body_data = body.get("custom_body")
- stream = body.get("stream")
+ try:
+ body = await request.json()
+ query_params_data = body.get("query_params")
+ custom_body_data = body.get("custom_body")
+ stream = body.get("stream")
+ except json.JSONDecodeError:
+ # Handle requests with no body (e.g., DELETE requests)
+ pass
elif "multipart/form-data" in content_type:
# ✅ Handle multipart form-data
form = await request.form()