mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 11:01:09 +00:00
Fix for HTTP API browser
Python 3 had data coming in as bytes.
This commit is contained in:
parent
bf1019c497
commit
e8eaddf375
@ -117,6 +117,8 @@ _validroles = ('Administrator', 'Operator', 'Monitor')
|
||||
|
||||
|
||||
def attrib_supports_expression(attrib):
|
||||
if not isinstance(attrib, str):
|
||||
attrib = attrib.decode('utf8')
|
||||
attrib = _attraliases.get(attrib, attrib)
|
||||
if attrib.startswith('secret.') or attrib.startswith('crypted.'):
|
||||
return False
|
||||
|
@ -182,6 +182,8 @@ def _get_query_dict(env, reqbody, reqtype):
|
||||
qdict[qkey] = qvalue
|
||||
if reqbody is not None:
|
||||
if "application/x-www-form-urlencoded" in reqtype:
|
||||
if not isinstance(reqbody, str):
|
||||
reqbody = reqbody.decode('utf8')
|
||||
pbody = urlparse.parse_qs(reqbody, True)
|
||||
for ky in pbody:
|
||||
if len(pbody[ky]) > 1: # e.g. REST explorer
|
||||
@ -190,6 +192,8 @@ def _get_query_dict(env, reqbody, reqtype):
|
||||
else:
|
||||
qdict[ky] = pbody[ky][0]
|
||||
elif 'application/json' in reqtype:
|
||||
if not isinstance(reqbody, str):
|
||||
reqbody = reqbody.decode('utf8')
|
||||
pbody = json.loads(reqbody)
|
||||
for key in pbody:
|
||||
qdict[key] = pbody[key]
|
||||
|
Loading…
Reference in New Issue
Block a user