From c1a3a1bc706190ac8a03c78c9d992c06e34b3333 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Tue, 19 Dec 2017 18:31:06 +0530 Subject: Fix http profile to override the headers Issue-ID: CLI-66 Change-Id: I0aa2413db977449f163bc4a75bcd7900c95076b8 Signed-off-by: Kanagaraj Manickam k00365106 --- .../java/org/onap/cli/fw/http/connect/OnapHttpConnection.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'profiles') 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; } } -- cgit 1.2.3-korg