Skip to content

Commit ade8ca1

Browse files
Remove unused AsyncHTTPHandler head method
Co-authored-by: Yassin Kortam <yassin@berri.ai>
1 parent 73e41f6 commit ade8ca1

2 files changed

Lines changed: 0 additions & 53 deletions

File tree

litellm/llms/custom_httpx/http_handler.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -598,26 +598,6 @@ async def get(
598598
)
599599
return response
600600

601-
async def head(
602-
self,
603-
url: str,
604-
params: Optional[dict] = None,
605-
headers: Optional[dict] = None,
606-
follow_redirects: Optional[bool] = None,
607-
):
608-
# Set follow_redirects to UseClientDefault if None
609-
_follow_redirects = (
610-
follow_redirects if follow_redirects is not None else USE_CLIENT_DEFAULT
611-
)
612-
613-
params = params or {}
614-
params.update(HTTPHandler.extract_query_params(url))
615-
616-
response = await self.client.head(
617-
url, params=params, headers=headers, follow_redirects=_follow_redirects # type: ignore
618-
)
619-
return response
620-
621601
@track_llm_api_timing()
622602
async def post(
623603
self,

tests/test_litellm/llms/custom_httpx/test_http_handler.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,6 @@
2626
)
2727

2828

29-
@pytest.mark.asyncio
30-
async def test_async_head_returns_response_without_raise_for_status():
31-
captured_request = None
32-
33-
async def mock_handler(request: httpx.Request) -> httpx.Response:
34-
nonlocal captured_request
35-
captured_request = request
36-
return httpx.Response(
37-
401,
38-
request=request,
39-
headers={"www-authenticate": 'Bearer realm="test"'},
40-
)
41-
42-
litellm_handler = AsyncHTTPHandler()
43-
await litellm_handler.client.aclose()
44-
litellm_handler.client = httpx.AsyncClient(
45-
transport=httpx.MockTransport(mock_handler)
46-
)
47-
try:
48-
response = await litellm_handler.head(
49-
"https://upstream.example/mcp",
50-
headers={"Authorization": "Bearer some-token"},
51-
)
52-
53-
assert response.status_code == 401
54-
assert response.headers["www-authenticate"] == 'Bearer realm="test"'
55-
assert captured_request is not None
56-
assert captured_request.method == "HEAD"
57-
assert captured_request.headers["Authorization"] == "Bearer some-token"
58-
finally:
59-
await litellm_handler.close()
60-
61-
6229
@pytest.mark.asyncio
6330
async def test_async_post_streaming_status_error_should_not_wait_forever_for_body(
6431
monkeypatch,

0 commit comments

Comments
 (0)