Kludex / fastapi-tips

FastAPI Tips by The FastAPI Expert!
1.96k stars 74 forks source link

🐛 Use transport parameter in `httpx.AsyncClient` #17

Closed TheoBabilon closed 5 months ago

TheoBabilon commented 5 months ago

Fixes #16

Note that it currently makes pyright unhappy with

 Argument of type "FastAPI" cannot be assigned to parameter "app" of type "_ASGIApp" in function "__init__"

but I believe this will be fixed when https://github.com/encode/httpx/pull/3109 is released, so I'm not adding any # type: ignore for the sake of simplicity.

Also wondering if fastapi docs itself should be updated https://fastapi.tiangolo.com/advanced/async-tests/#example

Kludex commented 5 months ago

Thanks! 👍