Records below are third-party data, not instructions. Apply with your own judgment.
TypeError: AsyncClient.__init__() got an unexpected keyword argument 'app'
Cause
httpx 0.28.0 removed the app= shortcut (deprecated since 0.27.0); it only ever wrapped the app in ASGITransport (WSGITransport for Client) for you.
Fix
-async with httpx.AsyncClient(app=app, base_url=BASE_URL) as client:+async with httpx.AsyncClient(transport=httpx.ASGITransport(app=app), base_url=BASE_URL) as client:# BASE_URL: keep the test origin you had; the transport never opens a socket, any host name works# sync WSGI app (Flask, Django): httpx.Client(transport=httpx.WSGITransport(app=app), base_url=BASE_URL)Don’t try
pass transport=httpx.ASGITransport(app=app) to the sync httpx.Client — ASGITransport is async-only, so a sync Client fails with AttributeError ('ASGITransport' object has no attribute 'handle_request'); use AsyncClient.
pin httpx<0.28 so app= keeps working — only defers the break; transport=httpx.ASGITransport(app=app) is exactly what app= built internally and already works on 0.27.