summaryrefslogtreecommitdiffstats
path: root/profiles/http
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-03-13 12:55:23 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-03-13 13:44:29 +0530
commit717f6901b358d06de252ea7a3e4e475746f1fba6 (patch)
tree07ef268f14420cb4ee7bee78cfe2de385c3d87aa /profiles/http
parent1239610d64ddfce2e3d1ff3378adcf96f24ee0a0 (diff)
remove empty json nodes
Issue-ID: CLI-101 Change-Id: I0e091e1289450f4e848933eebf9e6fb6801500a3 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'profiles/http')
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java13
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java2
2 files changed, 12 insertions, 3 deletions
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java
index 973c4ae1..43772e56 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java
@@ -133,9 +133,18 @@ public class OnapCommandSchemaHttpLoader {
cmd.getInput().setReqQueries(query);
break;
case OnapCommandHttpConstants.CONTEXT:
- Map<String, String> context = (Map<String, String>) map.get(key2);
+ Map<String, Object> context = (Map<String, Object>) map.get(key2);
+
+ for (String key: context.keySet()) {
+ switch (key) {
+ case OnapCommandHttpConstants.CONTEXT_REMOVE_EMPTY_JSON_NODES:
+ Boolean flag = (Boolean) context.get(OnapCommandHttpConstants.CONTEXT_REMOVE_EMPTY_JSON_NODES);
+ cmd.getInput().getContext().put(OnapCommandHttpConstants.CONTEXT_REMOVE_EMPTY_JSON_NODES, flag.toString());
+ break;
+ }
+ }
+
- cmd.getInput().getContext().putAll(context);
break;
case OnapCommandHttpConstants.MULTIPART_ENTITY_NAME:
Object multipartEntityName = map.get(key2);
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java b/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java
index 43a80181..b77b85da 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java
@@ -89,7 +89,7 @@ public class OnapCommandHttpUtils {
boolean isRemoveEmptyNodes = Boolean.parseBoolean(input.getContext().getOrDefault(OnapCommandHttpConstants.CONTEXT_REMOVE_EMPTY_JSON_NODES, "false"));
if (isRemoveEmptyNodes) {
- input.setBody(OnapCommandHttpUtils.normalizeJson(input.getBody()));
+ inp.setBody(OnapCommandHttpUtils.normalizeJson(input.getBody()));
}
return inp;