1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
From: Wh1isper <9573586@qq.com>
Date: Wed, 5 Feb 2025 19:25:53 +0800
Subject: fix: Migrate test case and docs to new httpx version
Origin: upstream, https://github.com/florimondmanca/httpx-sse/pull/29
Bug: https://github.com/florimondmanca/httpx-sse/issues/28
Last-Update: 2025-03-03
---
README.md | 2 +-
tests/test_asgi.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index f71c546..06e47f9 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ async def auth_events(request):
app = Starlette(routes=[Route("/sse/auth/", endpoint=auth_events)])
async def main():
- async with httpx.AsyncClient(app=app) as client:
+ async with httpx.AsyncClient(transport=httpx.ASGITransport(app)) as client:
async with aconnect_sse(
client, "GET", "http://localhost:8000/sse/auth/"
) as event_source:
diff --git a/tests/test_asgi.py b/tests/test_asgi.py
index dc69ec4..1f6ad81 100644
--- a/tests/test_asgi.py
+++ b/tests/test_asgi.py
@@ -29,7 +29,7 @@ def app() -> ASGIApp:
@pytest_asyncio.fixture
async def client(app: ASGIApp) -> AsyncIterator[httpx.AsyncClient]:
- async with httpx.AsyncClient(app=app) as client:
+ async with httpx.AsyncClient(transport=httpx.ASGITransport(app)) as client: # type: ignore[arg-type]
yield client
|