oEscal commented on code in PR #3937:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3937#discussion_r2445059237


##########
kogito-serverless-workflow/kogito-serverless-workflow-rest-runtime/src/main/java/org/kie/kogito/serverless/workflow/rest/JsonNodeResultHandler.java:
##########
@@ -33,18 +34,27 @@
 
 public class JsonNodeResultHandler implements RestWorkItemHandlerResult {
 
-    static final String STATUS_CODE = "statusCode";
-    static final String STATUS_MESSAGE = "statusMessage";
+    public static final String FAIL_ON_STATUS_ERROR = "failOnStatusCode";
+    public static final String STATUS_CODE = "statusCode";
+    public static final String STATUS_MESSAGE = "statusMessage";
+    public static final String RESPONSE_HEADERS = "responseHeaders";
 
     @Override
     public Object apply(HttpResponse<Buffer> t, Class<?> u, 
KogitoProcessContext context) {
         Map<String, Object> metadata = 
context.getNodeInstance().getNode().getMetaData();
-        if (metadata == null || 
toBoolean(metadata.getOrDefault("failOnStatusCode", Boolean.TRUE))) {
+        if (metadata == null || 
toBoolean(metadata.getOrDefault(FAIL_ON_STATUS_ERROR, Boolean.TRUE))) {
             checkStatusCode(t);
         } else {
             context.setVariable(STATUS_CODE, t.statusCode());
             context.setVariable(STATUS_MESSAGE, t.statusMessage());
         }
+
+        if (metadata != null) {
+            Map<String, String> headersMap = new HashMap<>();
+            t.headers().forEach(entry -> headersMap.put(entry.getKey(), 
entry.getValue()));
+            context.setVariable(RESPONSE_HEADERS, headersMap);
+        }

Review Comment:
   You are right, the verification of metadata was a remaining from the 
previous implementation I did 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to