aboutsummaryrefslogtreecommitdiffstats
path: root/profiles
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-12-19 18:31:06 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-12-19 18:31:06 +0530
commitc1a3a1bc706190ac8a03c78c9d992c06e34b3333 (patch)
treee5e50e254c59abd5311b623d03d61d6e9725c755 /profiles
parent9a17e473ab01142f0068bd69ac3f289494a909b0 (diff)
Fix http profile to override the headers
Issue-ID: CLI-66 Change-Id: I0aa2413db977449f163bc4a75bcd7900c95076b8 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'profiles')
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java b/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java
index a5a75e11..1ce0433c 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/connect/OnapHttpConnection.java
@@ -227,9 +227,13 @@ public class OnapHttpConnection {
private void addCommonHeaders(HttpInput input) {
if (!input.isBinaryData()) {
- input.getReqHeaders().put("Content-Type", OnapCommandHttpConstants.APPLICATION_JSON);
+ if (!input.getReqHeaders().containsKey("Content-Type")) {
+ input.getReqHeaders().put("Content-Type", OnapCommandHttpConstants.APPLICATION_JSON);
+ }
+ }
+ if (!input.getReqHeaders().containsKey("Accept")) {
+ input.getReqHeaders().put("Accept", OnapCommandHttpConstants.APPLICATION_JSON);
}
- input.getReqHeaders().put("Accept", OnapCommandHttpConstants.APPLICATION_JSON);
for (String headerName : this.mapCommonHeaders.keySet()) {
input.getReqHeaders().put(headerName, this.mapCommonHeaders.get(headerName));
@@ -328,7 +332,7 @@ public class OnapHttpConnection {
throw new OnapCommandHttpFailure(e);
} finally {
if (this.debug) {
- this.debugDetails = input + "" + result;
+ this.debugDetails = input + " " + result;
}
}