eluanb opened a new issue, #6480:
URL: https://github.com/apache/hop/issues/6480
### What would you like to happen?
### Problem
In the **HTTP Post** transform, when the request is sent as
**multipart/form-data** (e.g., **Post a file** / **Multipart upload**), the
configured **Body Parameters** (Fields tab) are not reliably sent, because they
can be overwritten by the multipart entity. Additionally, there is no reliable
way to control the **multipart file part name** required by many APIs (e.g.,
`file`, `upload`, `content`).
### Scenario / Steps to reproduce
1. Build a pipeline that provides:
* a file path (e.g. `/tmp/test.pdf`)
* additional fields to be sent as body parameters (e.g. `token`,
`docType`, `messageId`)
2. Configure **HTTP Post**:
* Enable **Post a file**, **Multipart upload**
* Set **Request entity field**
* Add **Body Parameters** in the **Fields** tab
3. Run and inspect the outgoing request (server/proxy logs).
### Expected behavior
Request is sent as `multipart/form-data` containing:
* **one file part** using a **configurable part name**
* **additional text parts** for the configured **Body Parameters**
### Actual behavior
* When multipart is used, **Body Parameters are ignored / not sent** (or get
overwritten by the multipart entity).
* File part name is not reliably configurable for endpoints that require a
specific multipart parameter name.
### Proposed fix
Use **existing fields only**:
1. Use the configured **Request entity field** as the **multipart file part
name** (fallback to `"file"` if blank).
2. When sending multipart (Post a file / multipart upload), include **Body
Parameters** as multipart **text parts** (via
`MultipartEntityBuilder.addTextBody(...)`) instead of setting them as a
separate request entity that gets replaced by the multipart entity.
### Patch / Implementation
I already have an implementation; the patch is attached for reference. Once
we agree on the approach (and I’m assigned to it), I will open a PR.
I attached a patch updating **HttpPost.java**.
Key points:
* Avoid setting a `StringEntity` for body parameters when the request will
send multipart (prevents overwrite).
* Add Body Parameters to `MultipartEntityBuilder` via `addTextBody(...)`.
* Set file part name using `meta.getRequestEntity()` (fallback `"file"`).
### Environment
* Hop version: `2.16`
* OS: `Microsoft Windows 11 10.0.26200 (Build 26200)`
* Java: `17.0.12+8-LTS-286`
### Additional info
I can provide a minimal `.hpl` reproduction and a sample endpoint contract
(expected multipart field names) if needed.
[HttpPost.patch](https://github.com/user-attachments/files/24970849/HttpPost.patch)
[HttpPost.java](https://github.com/user-attachments/files/24970850/HttpPost.java)
### Issue Priority
Priority: 3
### Issue Component
Component: Transforms
--
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]