ferenc-csaky commented on code in PR #17:
URL: 
https://github.com/apache/flink-connector-http/pull/17#discussion_r2781480016


##########
flink-connector-http/src/main/java/org/apache/flink/connector/http/table/lookup/querycreators/GenericJsonAndUrlQueryCreator.java:
##########
@@ -145,9 +149,36 @@ public LookupQueryInfo createLookupQuery(final RowData 
lookupDataRow) {
             // Body-based queries
             // serialize to a string for the body.
             try {
-                lookupQuery =
-                        ObjectMapperAdapter.instance()
-                                
.writeValueAsString(jsonObject.retain(requestBodyFields));
+                ObjectNode bodyJsonObject = 
jsonObject.retain(requestBodyFields);
+
+                // Merge additional JSON if provided
+                if (additionalRequestJson != null && 
!additionalRequestJson.trim().isEmpty()) {
+                    try {
+                        JsonNode additionalNode =
+                                
ObjectMapperAdapter.instance().readTree(additionalRequestJson);
+                        if (additionalNode.isObject()) {
+                            ObjectNode additionalObjectNode = (ObjectNode) 
additionalNode;
+                            // Merge all fields from additional JSON into the 
body
+                            // This preserves nested objects and arrays as-is
+                            additionalObjectNode
+                                    .fields()
+                                    .forEachRemaining(
+                                            entry ->
+                                                    bodyJsonObject.set(
+                                                            entry.getKey(), 
entry.getValue()));

Review Comment:
   You are also right, I ignored the wider context here, +1 for your suggestion.



-- 
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]

Reply via email to