davsclaus opened a new pull request, #27331:
URL: https://github.com/apache/camel/pull/27331

   [CAMEL-25309](https://issues.apache.org/jira/browse/CAMEL-25309)
   
   **The problem:** a Map or List body sent with the HTTP producer fails like 
this:
   
   ```
   InvalidPayloadException: No body available of type: java.io.InputStream but 
has type: java.util.LinkedHashMap on: order-1001.json. Caused by: No type 
converter available ...
   ```
   
   The message names the conversion, not what to do. The body is typically a 
Map after `unmarshal: json`, for example on a rest-openapi call to a JSON 
operation, which goes through camel-http. In the local-model benchmark 
(contracts/openapi-client), 3 of 5 runs failed on it.
   
   **The change:**
   - In `HttpProducer.createRequestEntity`, when a Map or Collection body 
cannot become a stream, the `InvalidPayloadException` keeps its type and uses 
the existing hint constructor to add: "a Map is not an HTTP request body: 
marshal it to JSON first (marshal: json) or set the body to the JSON text". A 
List gets the same with "List".
   - The converter's exception is kept as the cause.
   - Any other body type fails exactly as before.
   
   **Tests:**
   - New `HttpProducerMapBodyTest`: a LinkedHashMap body and a List body each 
get the hint.
   - The camel-http suite passes: 259 tests plus 9 isolated.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


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