From 6603a6b208f454e87215047a3116ca6d40cc56c2 Mon Sep 17 00:00:00 2001 From: as005h Date: Tue, 8 May 2018 14:01:50 -0400 Subject: Share http payload of restapi-call-node Changes to save request payload to context variable based on returnRequestPayload flag Change-Id: I75069f700f34848904204049d6160251ea43578d Issue-ID: CCSDK-365 Signed-off-by: Timoney, Dan (dt5972) --- .../java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java | 1 + .../org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'restapi-call-node/provider/src/main') diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java index c170cfc7d..d3fec37ee 100644 --- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java +++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java @@ -49,4 +49,5 @@ public class Parameters { public String oAuthSignatureMethod; public String oAuthVersion; public AuthType authtype; + public Boolean returnRequestPayload; } 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 d215d9092..5168b3ec1 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 @@ -112,6 +112,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { * customHttpHeadersOptionala list additional http headers to be passed in, follow the format in the exampleX-CSI-MessageId=messageId,headerFieldName=headerFieldValue * dumpHeadersOptionalwhen true writes http header content to context memorytrue or false * partnerOptionalneeded for DME2 callsdme2proxy + * returnRequestPayloadOptionalused to return payload built in the requesttrue or false * * * @param ctx Reference to context memory @@ -150,6 +151,10 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { ctx.setAttribute(pp + "header." + a.getKey(), StringUtils.join(a.getValue(), ",")); } } + + if (p.returnRequestPayload && req != null) { + ctx.setAttribute(pp + "httpRequest", req); + } if (r.body != null && r.body.trim().length() > 0) { ctx.setAttribute(pp + "httpResponse", r.body); @@ -246,6 +251,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { p.customHttpHeaders = parseParam(paramMap, "customHttpHeaders", false, null); p.partner = parseParam(paramMap, "partner", false, null); p.dumpHeaders = Boolean.valueOf(parseParam(paramMap, "dumpHeaders", false, null)); + p.returnRequestPayload = Boolean.valueOf(parseParam(paramMap, "returnRequestPayload", false, null)); return p; } -- cgit 1.2.3-korg