Hisoka-X commented on code in PR #8434:
URL: https://github.com/apache/seatunnel/pull/8434#discussion_r1948357630


##########
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/client/HttpClientProvider.java:
##########
@@ -115,14 +120,47 @@ public HttpResponse execute(
             String method,
             Map<String, String> headers,
             Map<String, String> params,
-            String body)
+            Map<String, Object> body,
+            Map<String, Object> pageParams,

Review Comment:
   as a http request until, why we need care pageParams? Can we handle it in 
https://github.com/apache/seatunnel/blob/b159cc0c75719a2ae73ec7e5a4bdc4bf63d4d7c8/seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSourceReader.java#L148?



##########
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/client/HttpClientProvider.java:
##########
@@ -115,14 +120,42 @@ public HttpResponse execute(
             String method,
             Map<String, String> headers,
             Map<String, String> params,
-            String body)
+            Map<String, Object> body,
+            Map<String, Object> pageParams,
+            boolean keepParamsAsForm)
             throws Exception {
         // convert method option to uppercase
         method = method.toUpperCase(Locale.ROOT);
+        // Keep the original post  logic
+        if (HttpPost.METHOD_NAME.equals(method) && keepParamsAsForm) {
+            URI uri = URI.create(url);
+            Map<String, Object> paramsMap = new HashMap<>();
+            if (MapUtils.isNotEmpty(params)) {
+                paramsMap.putAll(params);
+            }
+            if (MapUtils.isNotEmpty(pageParams)) {
+                paramsMap.putAll(params);
+            }
+            return doPost(uri, headers, paramsMap, body, true);
+        }
         if (HttpPost.METHOD_NAME.equals(method)) {
-            return doPost(url, headers, params, body);
+            // Create access address
+            URIBuilder uriBuilder = new URIBuilder(url);
+            // add parameter to uri
+            addParameters(uriBuilder, params);

Review Comment:
   @CosmosNi 



##########
docs/en/connector-v2/source/Http.md:
##########
@@ -181,6 +182,30 @@ connector will generate data as the following:
 |----------------------------------------------------------|
 | {"code":  200, "data":  "get success", "success":  true} |
 
+### keep_params_as_form
+For compatibility with old versions of http.
+When set to true,`<params>` and `<pageing>` will be submitted in the form.
+When set to false,`<params>` will be added to the url path,and `<pageing>` 
will be added to the body
+
+### params
+By default, the parameters will be added to the url path.
+If you need to keep the old version,see keep_params_as_form.

Review Comment:
   ```suggestion
   If you need to keep the old version behavior, please check 
keep_params_as_form.
   ```



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