2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-18 05:33:17 +00:00

Force 'databynode' to consistently be an array

If only one node was in given noderange, then
the httpapi response would not look similar in
structure to a multi-node response.  Force even
single items in this special case to be an array
to allow easier javascript client code.
This commit is contained in:
Jarrod Johnson 2015-11-03 09:08:18 -05:00
parent 310bd11669
commit 5a0ac899b9

View File

@ -537,7 +537,13 @@ def _assemble_json(responses, resource, url, extension):
else:
rspdata[dk] = [rspdata[dk], rsp[dk]]
else:
rspdata[dk] = rsp[dk]
if dk == 'databynode':
# a quirk, databynode suggests noderange
# multi response. This should *always* be a list,
# even if it will be length 1
rspdata[dk] = [rsp[dk]]
else:
rspdata[dk] = rsp[dk]
rspdata["_links"] = links
tlvdata.unicode_dictvalues(rspdata)
yield json.dumps(