This commit is contained in:
yumoqing 2023-08-10 17:46:09 +08:00
parent cfa5e822d5
commit 1feb656eb1

View File

@ -107,29 +107,30 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
return fname
async def getPostData(self,request: Request) -> dict:
qd = {}
if request.query:
qd = multiDict2Dict(request.query)
reader = None
try:
reader = await request.multipart()
except:
print('reader is None')
# print('reader is None')
pass
if reader is None:
md = await request.post()
if md == {}:
if request.query:
return multiDict2Dict(request.query)
else:
pd = await request.post()
pd = multiDict2Dict(pd)
if pd == {}:
if request.can_read_body:
x = await request.read()
try:
md = json.loads(x)
pd = json.loads(x)
except:
print('body is not a json')
print('request.query is None, md=', md)
ns = multiDict2Dict(md)
print(f'{ns=} reader is None, {request.query=}')
return ns
ns = {}
# print('body is not a json')
pass
qd.update(pd)
# print(f'{qd=} reader is None, {pd=}')
return qd
ns = qd
while 1:
try:
field = await reader.next()