You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/04/27 23:41:32 UTC

[GitHub] rafaelweingartner closed pull request #2428: CLOUDSTACK-10253: JSON response for SuccessResponse as boolean instead of string

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:
users@infra.apache.org


With regards,
Apache Git Services