[ https://issues.apache.org/jira/browse/CLOUDSTACK-10253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16457245#comment-16457245 ]
ASF GitHub Bot commented on CLOUDSTACK-10253: --------------------------------------------- rafaelweingartner closed pull request #2428: CLOUDSTACK-10253: JSON response for SuccessResponse as boolean instead of string URL: https://github.com/apache/cloudstack/pull/2428 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/server/src/main/java/com/cloud/api/response/ApiResponseSerializer.java b/server/src/main/java/com/cloud/api/response/ApiResponseSerializer.java index 2b9717de1e2..c72f957e99b 100644 --- a/server/src/main/java/com/cloud/api/response/ApiResponseSerializer.java +++ b/server/src/main/java/com/cloud/api/response/ApiResponseSerializer.java @@ -131,12 +131,8 @@ public static String toJSONSerializedString(ResponseObject result, StringBuilder sb.append("}"); log.append("}"); } - } else if (result instanceof SuccessResponse) { - sb.append("{\"success\":\"").append(((SuccessResponse)result).getSuccess()).append("\"}"); - log.append("{\"success\":\"").append(((SuccessResponse)result).getSuccess()).append("\"}"); - } else if (result instanceof ExceptionResponse) { - String jsonErrorText = responseBuilder.toJson(result); - jsonErrorText = unescape(jsonErrorText); + } else if (result instanceof SuccessResponse || result instanceof ExceptionResponse) { + final String jsonErrorText = unescape(responseBuilder.toJson(result)); sb.append(jsonErrorText); log.append(jsonErrorText); } else { diff --git a/test/integration/smoke/test_hostha_simulator.py b/test/integration/smoke/test_hostha_simulator.py index 4dfb9e9ba6c..bb25d477d02 100644 --- a/test/integration/smoke/test_hostha_simulator.py +++ b/test/integration/smoke/test_hostha_simulator.py @@ -161,7 +161,7 @@ def configureSimulatorHAProviderState(self, health, activity, recover, fence): cmd.recover = recover cmd.fence = fence response = self.apiclient.configureSimulatorHAProviderState(cmd) - self.assertEqual(response.success, 'true') + self.assertEqual(response.success, True) def getSimulatorHAStateTransitions(self, hostId): ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > JSON response returns boolean as string > --------------------------------------- > > Key: CLOUDSTACK-10253 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10253 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API > Reporter: Marc-Aurèle Brothier > Assignee: Marc-Aurèle Brothier > Priority: Minor > > On the SuccessResponse for async call, the boolean value is returned as a > quoted boolean string: > {noformat} > {"success": "true"}{noformat} > instead of a JSON boolean: > {noformat} > {"success": true{noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)