fix(http_handler.py): return original response headers

This commit is contained in:
Krrish Dholakia 2024-11-30 01:54:49 -08:00
parent 9c35a3b554
commit aee601d1d8
2 changed files with 4 additions and 1 deletions

View file

@ -78,6 +78,7 @@ class MaskedHTTPStatusError(httpx.HTTPStatusError):
response=httpx.Response( response=httpx.Response(
status_code=original_error.response.status_code, status_code=original_error.response.status_code,
content=original_error.response.content, content=original_error.response.content,
headers=original_error.response.headers,
), ),
) )
self.message = message self.message = message

View file

@ -1146,7 +1146,9 @@ async def test_exception_with_headers_httpx(
except litellm.RateLimitError as e: except litellm.RateLimitError as e:
exception_raised = True exception_raised = True
assert e.litellm_response_headers is not None assert (
e.litellm_response_headers is not None
), "litellm_response_headers is None"
print("e.litellm_response_headers", e.litellm_response_headers) print("e.litellm_response_headers", e.litellm_response_headers)
assert int(e.litellm_response_headers["retry-after"]) == cooldown_time assert int(e.litellm_response_headers["retry-after"]) == cooldown_time