Claus Ibsen created CAMEL-25745:
-----------------------------------

             Summary: camel-http - make it stand out that a message with a body 
is sent as a POST unless httpMethod is set
                 Key: CAMEL-25745
                 URL: https://issues.apache.org/jira/browse/CAMEL-25745
             Project: Camel
          Issue Type: Improvement
          Components: camel-http
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The http producer picks the HTTP method from the message body when neither the 
{{httpMethod}} option nor the {{CamelHttpMethod}} header sets it: a message 
with a body is sent as a POST, and a message without a body as a GET. After 
{{unmarshal}}, {{split}} or {{setBody}} the message has a body, so a call meant 
as a GET is sent as a POST. This trips many users, and also AI models: in the 
overnight benchmark of Oct 17-18, a step that calls a stock service for each 
line of a split order failed 6 of 10 times on it ("No body available of type: 
java.io.InputStream but has type: java.util.LinkedHashMap"). The behaviour 
cannot change without breaking existing applications, so the documentation and 
the error should make the rule stand out.

Proposal:
* The http page starts its Usage section with "Which HTTP method will be used": 
the rule, the trap, the fix ({{httpMethod: GET}}; a GET sends no body unless 
{{getWithBody}} is true) and a YAML example. The section is then also in the 
start of the page that {{camel_catalog_doc}} returns.
* "How to set the http method" shows the {{httpMethod}} option first, then the 
header.
* The error for a Map or List body (CAMEL-25309) says, when the method came 
from the body, that the call is a POST because the message has a body, and to 
set {{httpMethod}} GET for a GET.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to