bugfix
This commit is contained in:
parent
817a2b9639
commit
542c2d2660
@ -177,6 +177,7 @@ class UAPI:
|
||||
gen = liner(self.__call__(upappid, apiname, callerid, params=params))
|
||||
async for line in gen:
|
||||
debug(f'{line=},{type(line)=}')
|
||||
respline = line
|
||||
line = line.decode('utf-8')
|
||||
filter = self.uapi.chunk_match
|
||||
if not filter:
|
||||
@ -189,7 +190,7 @@ class UAPI:
|
||||
line = await self.rendertmpl(self.uapi.response, dic)
|
||||
line = self.filter_nl_cr(line)
|
||||
except Exception as e:
|
||||
debug(f'{line=}, {self.uapi.response=} error({e})\n{format_exc()}')
|
||||
debug(f'{respline=}, {line=}, {self.uapi.response=} error({e})\n{format_exc()}')
|
||||
continue
|
||||
if len(line):
|
||||
yield f'{line}\n'
|
||||
@ -201,9 +202,12 @@ class UAPI:
|
||||
async for chunk in self.__call__(upappid, apiname, callerid, params=params):
|
||||
b += chunk
|
||||
if self.uapi.response:
|
||||
dic = json.loads(b.decode('utf-8'))
|
||||
s = await self.rendertmpl(self.uapi.response, dic)
|
||||
b = s.encode('utf-8')
|
||||
try:
|
||||
dic = json.loads(b.decode('utf-8'))
|
||||
s = await self.rendertmpl(self.uapi.response, dic)
|
||||
b = s.encode('utf-8')
|
||||
except Exception as e:
|
||||
debug('http.response={b}, response_template={self.uapi.response}, error={e}')
|
||||
return b
|
||||
|
||||
async def do_auth(self, auth_uapi):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user