litellm/tests/unit/llms/custom_httpx
izzybn 050aec309f
fix(exceptions): keep the provider error body on e.response for SDK callers (#53587)
* fix(sdk): keep the provider error body on e.response for Responses and shared handler errors

SDK callers who caught a litellm exception got an empty e.response, so e.response.text was '' and e.response.json() raised JSONDecodeError

The exception now carries the provider's status, body, and charset. Its headers and request stay as they were, so proxy replies and retry behavior do not change, and the outbound credentials are never attached

* fix(exceptions): keep the reported status when attaching the provider reply

* fix(exceptions): keep mapped errors for text status codes and attach provider replies on post-response status checks

* fix(vector_stores): keep the provider reply body when a provider config raises a litellm exception

* fix(files): keep the provider reply body on file content download errors

* fix(search): keep the provider reply body on search errors, and give it the exception's status when it had no response

* fix(exceptions): give a remapped error's provider reply the remapped status

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-23 07:23:53 +00:00
..
__init__.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_accept_encoding.py fix(http): stop advertising zstd so streamed responses survive per-event frames (#53439) 2026-11-21 23:58:04 +00:00
test_aiohttp_cleanup_closed.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_aiohttp_handler.py fix(http): diagnose aiohttp connection pool saturation (#49499) 2026-10-31 16:12:30 -07:00
test_aiohttp_so_keepalive.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_aiohttp_transport.py test(aiohttp): verify streaming timeouts without wall-clock delays (#53189) 2026-11-20 21:20:48 +00:00
test_asgi_handler.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_async_client_cleanup.py test: move 76 live top-level tests to offline unit and integration coverage (#45352) 2026-10-08 10:33:35 -07:00
test_container_handler.py test: catch regressions in the validation lines #44798 added (#47420) 2026-10-20 01:06:37 +00:00
test_credential_leak_prevention.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_gemini_session_leak.py test(unit): stop test modules from putting their own directory on sys.path (#43421) 2026-09-28 12:20:20 -07:00
test_http2_connection_spread.py feat(vertex_ai)!: use HTTP/2 httpx client for search_api vector store (#40631) 2026-10-29 10:31:18 -07:00
test_http_handler.py fix(httpx): repair surrogate code points in raw text request bodies (#49599) 2026-11-19 11:48:18 -08:00
test_llm_http_handler.py fix(exceptions): keep the provider error body on e.response for SDK callers (#53587) 2026-11-23 07:23:53 +00:00
test_mock_transport.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_sse_lines.py fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00