11import time
22
3- import httpx
3+ import httpx2
44import pytest
55from mcp_types import (
66 CallToolRequestParams ,
@@ -41,11 +41,11 @@ async def _handle_list_tools(ctx: ServerRequestContext, params: PaginatedRequest
4141 return ListToolsResult (tools = [Tool (name = "whoami" , input_schema = {"type" : "object" , "properties" : {}})])
4242
4343
44- class _MutableBearerAuth (httpx .Auth ):
44+ class _MutableBearerAuth (httpx2 .Auth ):
4545 def __init__ (self , token : str | None ) -> None :
4646 self .token = token
4747
48- def auth_flow (self , request : httpx .Request ):
48+ def auth_flow (self , request : httpx2 .Request ):
4949 if self .token is not None :
5050 request .headers ["Authorization" ] = f"Bearer { self .token } "
5151 yield request
@@ -54,12 +54,12 @@ def auth_flow(self, request: httpx.Request):
5454async def _call_whoami (asgi_app : Starlette , host : str , token : str | None ) -> str :
5555 auth = _MutableBearerAuth (token )
5656 async with (
57- httpx .ASGITransport (asgi_app ) as transport ,
58- httpx .AsyncClient (
57+ httpx2 .ASGITransport (asgi_app ) as transport ,
58+ httpx2 .AsyncClient (
5959 transport = transport ,
6060 base_url = f"http://{ host } " ,
6161 auth = auth ,
62- timeout = httpx .Timeout (30 , read = 30 ),
62+ timeout = httpx2 .Timeout (30 , read = 30 ),
6363 follow_redirects = True ,
6464 ) as http_client ,
6565 ):
0 commit comments