Skip to content

Commit

Permalink
Return 500 when no api action is successful
Browse files Browse the repository at this point in the history
fixes #5095
  • Loading branch information
Crunsher committed Apr 5, 2018
1 parent e08231f commit a9c6089
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/remote/actionshandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,19 @@ bool ActionsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques
}
}

response.SetStatus(500, "No action executed successfully");

for (const Dictionary::Ptr& res : results) {
if (!res->Contains("result") && res->Get("result") == 200) {
response.SetStatus(200, "OK");
break;
}
}

Dictionary::Ptr result = new Dictionary({
{ "results", new Array(std::move(results)) }
});

response.SetStatus(200, "OK");
HttpUtility::SendJsonBody(response, params, result);

return true;
Expand Down

0 comments on commit a9c6089

Please sign in to comment.