bugfix
This commit is contained in:
parent
9b45e65ddf
commit
8ad75cbe80
@ -102,16 +102,16 @@ class BaseProcessor:
|
||||
elif isinstance(self.content, StreamResponse):
|
||||
return self.content
|
||||
elif isinstance(self.content, DictObject):
|
||||
self.content = json.dumps(self.content, indent=4)
|
||||
self.content = json.dumps(self.content, indent=4, ensure_ascii=False)
|
||||
jsonflg = True
|
||||
elif isinstance(self.content, dict):
|
||||
self.content = json.dumps(self.content, indent=4)
|
||||
self.content = json.dumps(self.content, indent=4, ensure_ascii=False)
|
||||
jsonflg = True
|
||||
elif isinstance(self.content, list):
|
||||
self.content = json.dumps(self.content, indent=4)
|
||||
self.content = json.dumps(self.content, indent=4, ensure_ascii=False)
|
||||
jsonflg = True
|
||||
elif isinstance(self.content, tuple):
|
||||
self.content = json.dumps(self.content, indent=4)
|
||||
self.content = json.dumps(self.content, indent=4, ensure_ascii=False)
|
||||
jsonflg = True
|
||||
elif isinstance(self.content, bytes):
|
||||
self.headers['Access-Control-Expose-Headers'] = 'Set-Cookie'
|
||||
|
@ -38,7 +38,7 @@ class TmpFileRecord:
|
||||
if not self.change_flg:
|
||||
return
|
||||
async with aiofiles.open(self.filename, 'bw') as f:
|
||||
s = json.dumps(self.filetime)
|
||||
s = json.dumps(self.filetime, indent=4, ensure_ascii=False)
|
||||
b = s.encode('utf-8')
|
||||
await f.write(b)
|
||||
await f.flush()
|
||||
|
@ -60,7 +60,7 @@ async def stream_response(request, async_data_generator, content_type='text/html
|
||||
elif isinstance(d, str):
|
||||
await res.write(d.encode('utf-8'))
|
||||
else:
|
||||
d = json.dumps(d)
|
||||
d = json.dumps(d, indent=4, ensure_ascii=False)
|
||||
await res.write(d.encode('utf-8'))
|
||||
await res.drain()
|
||||
await res.write_eof()
|
||||
|
@ -58,7 +58,7 @@ class StreamLlmProxy:
|
||||
if f and f(v,v1):
|
||||
j[self.api.chunk_filter.field] = ''
|
||||
|
||||
jstr = json.dumps(j) + '\n'
|
||||
jstr = json.dumps(j, indent=4, ensure_ascii=False) + '\n'
|
||||
bin = jstr.encode('utf-8')
|
||||
await self.resp.write(bin)
|
||||
await self.resp.drain()
|
||||
@ -114,7 +114,7 @@ class StreamLlmProxy:
|
||||
hc = HttpClient()
|
||||
resp_data = await hc.request(url, method, response_type=RESPONSE_JSON,
|
||||
params=_params,
|
||||
data=None if _data == {} else json.dumps(_data),
|
||||
data=None if _data == {} else json.dumps(_data, indent=4, ensure_ascii=False),
|
||||
headers=_headers)
|
||||
resp_data = DictObject(**resp_data)
|
||||
for sd in d.set_data:
|
||||
@ -171,7 +171,7 @@ class StreamLlmProxy:
|
||||
debug(f'{url=},{method=},{_params=},{_data=},{_headers=}')
|
||||
resp_data = await hc.request(url, method, response_type=response_type,
|
||||
params=_params,
|
||||
data=None if _data == {} else json.dumps(_data),
|
||||
data=None if _data == {} else json.dumps(_data, indent=4, ensure_ascii=False),
|
||||
stream_func=self.stream_handle,
|
||||
headers=_headers)
|
||||
if self.remain_str != '':
|
||||
@ -215,7 +215,7 @@ class SyncLlmProxy(StreamLlmProxy):
|
||||
debug(f'{url=},{method=},{_params=},{_data=},{_headers=}')
|
||||
resp_data = await hc.request(url, method, response_type=response_type,
|
||||
params=_params,
|
||||
data=None if _data == {} else json.dumps(_data),
|
||||
data=None if _data == {} else json.dumps(_data, indent=4, ensure_ascii=False),
|
||||
headers=_headers)
|
||||
debug(f'{resp_data=}')
|
||||
if resp_data is None:
|
||||
@ -270,7 +270,7 @@ class AsyncLlmProxy(StreamLlmProxy):
|
||||
debug(f'{url=},{method=},{_params=},{_data=},{_headers=}')
|
||||
resp_data = await hc.request(url, method, response_type=response_type,
|
||||
params=_params,
|
||||
data=None if _data == {} else json.dumps(_data),
|
||||
data=None if _data == {} else json.dumps(_data, indent=4, ensure_ascii=False),
|
||||
headers=_headers)
|
||||
if self.remain_str != '':
|
||||
await self.write_chunk(self.remain_str)
|
||||
|
@ -49,7 +49,7 @@ class SQLDataSourceProcessor(DataSourceProcessor):
|
||||
rec = [ r for r in sql(sqldesc['db'],ns) if r['name']!='_row_id' ]
|
||||
dict_data['datadesc'] = rec
|
||||
f = codecs.open(self.src_file,'w',self.config.website.coding)
|
||||
b = json.dumps(dict_data,indent=4)
|
||||
b = json.dumps(dict_data, indent=4, ensure_ascii=False)
|
||||
f.write(b)
|
||||
f.close()
|
||||
return rec
|
||||
|
@ -90,7 +90,7 @@ class XtermProcessor(PythonScriptProcessor):
|
||||
"type":1,
|
||||
"data":s
|
||||
}
|
||||
await ws.send_str(json.dumps(data))
|
||||
await ws.send_str(json.dumps(data, indent=4, ensure_ascii=False))
|
||||
|
||||
def close_process(self):
|
||||
self.sshnode.close()
|
||||
@ -102,7 +102,7 @@ async def ws_send(ws:web.WebSocketResponse, data):
|
||||
"type":1,
|
||||
"data":data
|
||||
}
|
||||
d = json.dumps(d)
|
||||
d = json.dumps(d, indent=4, ensure_ascii=False)
|
||||
try:
|
||||
return await ws.send_str(d)
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user