mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 19:10:10 +00:00
Change http console replies to not always put things under 'data'.
To resemble more strongly the socket api, have the HTTP response resemble a normal reply more closely.
This commit is contained in:
parent
e2e2d884b7
commit
d859615e45
@ -280,12 +280,16 @@ def resourcehandler(env, start_response):
|
||||
consolesessions[sessid]['expiry'] = time.time() + 90
|
||||
outdata = consolesessions[sessid]['session'].get_next_output(
|
||||
timeout=45)
|
||||
if isinstance(outdata, dict):
|
||||
rspdata = outdata
|
||||
rspdata['session'] = querydict['session']
|
||||
else:
|
||||
rspdata = {'session': querydict['session'],
|
||||
'data': outdata}
|
||||
try:
|
||||
rsp = json.dumps({'session': querydict['session'],
|
||||
'data': outdata})
|
||||
rsp = json.dumps(rspdata)
|
||||
except UnicodeDecodeError:
|
||||
rsp = json.dumps({'session': querydict['session'],
|
||||
'data': outdata}, encoding='cp437')
|
||||
rsp = json.dumps(rspdata, encoding='cp437')
|
||||
except UnicodeDecodeError:
|
||||
rsp = json.dumps({'session': querydict['session'],
|
||||
'data': 'DECODEERROR'})
|
||||
|
Loading…
Reference in New Issue
Block a user