summaryrefslogtreecommitdiffstats
path: root/restapi-call-node
diff options
context:
space:
mode:
authorGanesh Chandrasekaran <ganesh.c@samsung.com>2018-04-02 17:29:53 +0900
committerGanesh Chandrasekaran <ganesh.c@samsung.com>2018-04-02 17:48:24 +0900
commit09031e372568052390f514ad37efa919299153a4 (patch)
tree4523c8a03e0c6af85d838bfdeb3919e3405e635e /restapi-call-node
parentc6029168cd1b95ef2c4a2b554fd0f3b61df185da (diff)
RESTapiCallNode make request without content-type
currently the RESTAPI adaptor doesn't make a REST request with empty Content-type, this change is to help the adaptor to make request with no Content-type, currently defaulting to application/json. This is to avoid, when some servers throw 415 Unsupported Media Type error, when they dont support JSON response. Issue-ID: CCSDK-232 Change-Id: I19fbb949f0aad4ea7ca91d6afcac06a5b7f8deed Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'restapi-call-node')
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Format.java4
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java5
2 files changed, 7 insertions, 2 deletions
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Format.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Format.java
index 776485af..1578ee32 100644
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Format.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Format.java
@@ -22,13 +22,15 @@
package org.onap.ccsdk.sli.plugins.restapicall;
public enum Format {
- JSON, XML;
+ JSON, XML, NONE;
public static Format fromString(String s) {
if ("json".equalsIgnoreCase(s))
return JSON;
if ("xml".equalsIgnoreCase(s))
return XML;
+ if ("none".equalsIgnoreCase(s))
+ return NONE;
throw new IllegalArgumentException("Invalid value for format: " + s);
}
}
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 e5c18596..ea2d259b 100644
--- 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
@@ -437,7 +437,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
Client client = Client.create(config);
client.setConnectTimeout(5000);
- if (p.restapiUser != null)
+ if (p.restapiUser != null && p.restapiPassword != null)
client.addFilter(new HTTPBasicAuthFilter(p.restapiUser, p.restapiPassword));
WebResource webResource = client.resource(p.restapiUrl);
@@ -457,6 +457,9 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
}
WebResource.Builder webResourceBuilder = webResource.accept(tt).type(tt1);
+ if(p.format == Format.NONE){
+ webResourceBuilder = webResource.header("","");
+ }
if (p.customHttpHeaders != null && p.customHttpHeaders.length() > 0) {
String[] keyValuePairs = p.customHttpHeaders.split(",");