summaryrefslogtreecommitdiffstats
path: root/restapi-call-node
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2019-09-11 20:28:15 +0000
committerKevin Smokowski <kevin.smokowski@att.com>2019-09-12 12:49:23 +0000
commiteb00a7cdf2828a3030595e14e142ad1250b45e5b (patch)
tree92bf0300d0abe0a33364e4dba16d62dfeb35bfa5 /restapi-call-node
parent300ec08d358c3b23bd65e96a0f642b9a8e86106e (diff)
rest api call node content type fix
Don't set content-type header when there is no content/body Issue-ID: CCSDK-1703 Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> Change-Id: I247f571bf0d4fc021a1b32936b3dc33473b35f89
Diffstat (limited to 'restapi-call-node')
-rwxr-xr-xrestapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
index 8038b94ce..b93887ffc 100755
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
@@ -788,8 +788,6 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
WebTarget webTarget = addAuthType(client, p).target(p.restapiUrl);
- log.info("Sending request below to url " + p.restapiUrl);
- log.info(request);
long t1 = System.currentTimeMillis();
HttpResponse r = new HttpResponse();
@@ -828,7 +826,15 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
Response response;
try {
- response = invocationBuilder.method(p.httpMethod.toString(), entity(request, contentType));
+ // When the HTTP operation has no body do not set the content-type
+ //setting content-type has caused errors with some servers when no body is present
+ if (request == null) {
+ response = invocationBuilder.method(p.httpMethod.toString());
+ } else {
+ log.info("Sending request below to url " + p.restapiUrl);
+ log.info(request);
+ response = invocationBuilder.method(p.httpMethod.toString(), entity(request, contentType));
+ }
} catch (ProcessingException | IllegalStateException e) {
throw new SvcLogicException(requestPostingException + e.getLocalizedMessage(), e);
}