gilvansfilho commented on code in PR #10388:
URL: https://github.com/apache/camel/pull/10388#discussion_r1230891586


##########
core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java:
##########
@@ -163,6 +178,40 @@ public static String bodyOneLine(Exchange exchange) {
         return body;
     }
 
+    public static String prettyBody(Exchange exchange) {
+        String body = exchange.getIn().getBody(String.class);
+
+        if (body == null) {
+            return null;
+        } else if (body.startsWith("{") && body.endsWith("}") || 
body.startsWith("[") && body.endsWith("]")) {
+            body = Jsoner.prettyPrint(body); //json
+        } else if (body.startsWith("<") && body.endsWith(">")) {
+            return CSimpleHelper.prettyXml(body); //xml
+        }

Review Comment:
   is this header always set? What if user load data from a file?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to