This commit is contained in:
yumoqing 2023-08-10 12:02:53 +08:00
parent eef568c695
commit cfa5e822d5

View File

@ -5,6 +5,7 @@ from traceback import print_exc
# from showcallstack import showcallstack # from showcallstack import showcallstack
import asyncio import asyncio
import json
from yarl import URL from yarl import URL
@ -110,14 +111,23 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
try: try:
reader = await request.multipart() reader = await request.multipart()
except: except:
print('reader is None')
pass pass
if reader is None: if reader is None:
md = await request.post() md = await request.post()
if md == {}: if md == {}:
if request.query: if request.query:
return multiDict2Dict(request.query) return multiDict2Dict(request.query)
else:
if request.can_read_body:
x = await request.read()
try:
md = json.loads(x)
except:
print('body is not a json')
print('request.query is None, md=', md)
ns = multiDict2Dict(md) ns = multiDict2Dict(md)
# print(f'{ns=} reader is None, {request.query=}') print(f'{ns=} reader is None, {request.query=}')
return ns return ns
ns = {} ns = {}
while 1: while 1: