Skip to content

Commit

Permalink
Support array result
Browse files Browse the repository at this point in the history
  • Loading branch information
ningyougang committed Jul 25, 2022
1 parent 4f85c39 commit 0aff198
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/actionProxy/actionproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def run(self, args, env):
def error(msg):
# fall through (exception and else case are handled the same way)
sys.stdout.write('%s\n' % msg)
return (502, {'error': 'The action did not return a dictionary.'})
return (502, {'error': 'The action did not return a dictionary or array.'})

try:
input = json.dumps(args)
Expand Down Expand Up @@ -186,7 +186,7 @@ def error(msg):

try:
json_output = json.loads(lastLine)
if isinstance(json_output, dict):
if isinstance(json_output, dict) or isinstance(json_output, list):
return (200, json_output)
else:
return error(lastLine)
Expand Down Expand Up @@ -258,7 +258,7 @@ def init(message=None):

def run(message=None):
def error():
response = flask.jsonify({'error': 'The action did not receive a dictionary as an argument.'})
response = flask.jsonify({'error': 'The action did not receive a dictionary or array as an argument.'})
response.status_code = 404
return complete(response)

Expand All @@ -269,7 +269,7 @@ def error():
return error()
else:
args = message.get('value', {}) if message else {}
if not isinstance(args, dict):
if not (isinstance(args, dict) or isinstance(args, list)):
return error()

if runner.verify():
Expand Down

0 comments on commit 0aff198

Please sign in to comment.