mirror of
https://github.com/MeoProject/lx-music-api-server.git
synced 2025-05-23 19:17:41 +08:00
尝试修复记录日志时出现的 'str' object has no attribute 'status'问题
This commit is contained in:
parent
514c8df365
commit
635ae720b9
6
main.py
6
main.py
@ -70,6 +70,12 @@ async def handle_before_request(app, handler):
|
||||
return handleResult({'code': 6, 'msg': '未找到您所请求的资源', 'data': None}, 404)
|
||||
|
||||
resp = await handler(request)
|
||||
if (isinstance(resp, str)):
|
||||
resp = Response(body = resp, content_type='text/plain', status = 200)
|
||||
elif (isinstance(resp, dict):
|
||||
resp = handleResult(resp)
|
||||
elif (not isinstance(resp, Response)):
|
||||
resp = Response(body = str(resp), content_type='text/plain', status = 200)
|
||||
aiologger.info(f'{request.remote_addr} - {request.method} "{request.path}", {resp.status}')
|
||||
return resp
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user