fatmanverse opened a new issue, #13726:
URL: https://github.com/apache/seatunnel/issues/13726

   ### Search before asking
   
   - [x] I searched existing issues and PRs and found no duplicate of this 
reproducer.
   
   ### What happened
   
   With `format = binary`, `method = POST` and `keep_params_as_form = false`, 
configured `params` are missing from the URL. When `body` is present the 
parameters are dropped; without `body` they are sent as form fields. Text/JSON 
requests already put them in the query. This affects both the source reader 
streaming path and `HttpClientProvider.executeBinary()`.
   
   Both requests should have query `existing=ok&exportId=a%2Bb+%2F`. The JSON 
body should stay unchanged when present; when omitted, the request body should 
be empty.
   
   ### SeaTunnel Version
   
   `dev`, `3.1.1-SNAPSHOT`, commit `0bef81d003a9dcc3266a10140dc639534ad81bfd`. 
This report establishes the behavior on this revision; released-version 
coverage was not tested.
   
   ### SeaTunnel Config
   
   ```hocon
   env {
     job.mode = "BATCH"
     parallelism = 1
   }
   source {
     Http {
       url = "http://127.0.0.1:18080/pages?existing=ok";
       method = "POST"
       format = "binary"
       params = { exportId = "a+b /" }
       keep_params_as_form = false
       body = """{"filter":{"name":"example"}}"""
     }
   }
   sink { Console {} }
   ```
   
   ### Running Command
   
   Reproduced through `HttpSource.createReader()` and `pollNext()` using a real 
loopback HTTP server in a JUnit test. The loopback endpoint returns five binary 
bytes and `Content-Disposition: attachment; filename=export.bin`. Repeat with 
and without `body`.
   
   The [regression 
test](https://github.com/fatmanverse/seatunnel/blob/cb82cee57dd83864a86af36d7448b7dff7d55d1d/seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpBinaryRequestTest.java)
 starts its own server on a dynamically allocated port; no external service is 
needed. To reproduce against the original production code at the revision 
above, copy only that test into a disposable checkout and run:
   
   ```sh
   # In a disposable checkout of the affected dev revision:
   git fetch https://github.com/fatmanverse/seatunnel.git 
fix-http-binary-post-query-params
   git checkout cb82cee57dd83864a86af36d7448b7dff7d55d1d -- 
seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpBinaryRequestTest.java
   ./mvnw -B -ntp -pl 
seatunnel-connectors-v2/connector-http/connector-http-base -am \
     -DskipITs -Dskip.spotless=true -Dsurefire.timeout=60 \
     -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \
     -Dtest=HttpBinaryRequestTest clean verify
   ```
   
   ### Error Exception
   
   ```text
   expected: <existing=ok&exportId=a%2Bb+%2F> but was: <existing=ok>
   ```
   
   4 of 12 test cases fail on the original code; the remaining cases check 
preserved behavior. 
   
   ### Zeta or Flink or Spark Version
   
   Connector-level regression; no engine was started.
   
   ### Java or Scala Version
   
   Original-code reproduction: Temurin 11.0.32.1 on Linux. The corresponding 
fix was checked on JDK 11 and JDK 17.
   
   ### Are you willing to submit PR?
   
   - [x] Yes, I am willing to submit a PR.
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct).
   


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