修复 httpx async with client.post() 的隐藏坑
· 阅读需 2 分钟
在构建多服务协作的 SaaS 系统时遇到此问题,记录根因与解法。
TL;DR
httpx.AsyncClient 不要用 async with client.post() 模式,应该先创建 client 再调用方法:response = await client.post()。
在构建多服务协作的 SaaS 系统时遇到此问题,记录根因与解法。
httpx.AsyncClient 不要用 async with client.post() 模式,应该先创建 client 再调用方法:response = await client.post()。