fix: resolve Content-Length mismatch in pass-through endpoints

This commit is contained in:
Rohit Panda 2025-04-23 17:42:53 +00:00
parent b82af5b826
commit e4e76c6261

View file

@ -402,13 +402,14 @@ class HttpPassThroughEndpointHelpers:
requested_query_params=requested_query_params,
)
else:
json_str = json.dumps(_parsed_body) # Pre-serialize JSON to avoid Content-Length mismatch
# Generic httpx method
response = await async_client.request(
method=request.method,
url=url,
headers=headers,
params=requested_query_params,
json=_parsed_body,
data=json_str
)
return response
@ -584,10 +585,11 @@ async def pass_through_request( # noqa: PLR0915
},
)
if stream:
json_str = json.dumps(_parsed_body) # Pre-serialize JSON to avoid Content-Length mismatch
req = async_client.build_request(
"POST",
url,
json=_parsed_body,
data=json_str,
params=requested_query_params,
headers=headers,
)