我正在处理的fastAPI不会在请求失败时返回traceback,而是返回500内部服务器错误,并显示以下错误:
ERROR: ASGI callable returned without starting response.
2021-05-14 16:12:08 - uvicorn.error:409 - ERROR - ASGI callable returned without starting response.有没有人以前遇到过这个问题,并知道解决方法?
发布于 2021-05-15 05:47:02
我的问题是由定制中间件引起的。我已经能够更新中间件并解决这个问题。
发布于 2021-08-06 13:32:50
很可能您的中间件的__ call __方法不能很好地工作。我建议检查中间件中的构建,并与您的进行比较。例如:
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "http":
await self.app(scope, receive, send)
return
request = Request(scope, receive=receive)
response = await self.dispatch_func(request, self.call_next)
await response(scope, receive, send)https://stackoverflow.com/questions/67540578
复制相似问题