This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit aea56ae6a7fc1677ff1bf839c19366598fe009e5
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Oct 24 20:26:46 2026 +0200

    CAMEL-26063: camel-vertx-http - the httpMethod option is not overridden by 
the CamelHttpMethod header (#28330)
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/component/vertx/http/DefaultVertxHttpBinding.java       | 7 +++++--
 .../apache/camel/component/vertx/http/VertxHttpMethodTest.java    | 8 ++++++++
 .../modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc           | 7 +++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
 
b/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
index d90764122458..bfea3e1506de 100644
--- 
a/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
+++ 
b/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
@@ -55,8 +55,11 @@ public class DefaultVertxHttpBinding implements 
VertxHttpBinding {
         // Query string is already encoded in resolveHttpURI to avoid 
decode/re-encode issues
         URI uri = VertxHttpHelper.resolveHttpURI(exchange, endpoint);
 
-        // Determine the HTTP method to use if not specified in the 
HTTP_METHOD header
-        HttpMethod method = message.getHeader(VertxHttpConstants.HTTP_METHOD, 
configuration.getHttpMethod(), HttpMethod.class);
+        // as camel-http: the method of the endpoint, which the HTTP_METHOD 
header cannot override, then the header
+        HttpMethod method = configuration.getHttpMethod();
+        if (method == null) {
+            method = message.getHeader(VertxHttpConstants.HTTP_METHOD, 
HttpMethod.class);
+        }
         if (method == null) {
             if (ObjectHelper.isNotEmpty(uri.getQuery())) {
                 method = HttpMethod.GET;
diff --git 
a/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpMethodTest.java
 
b/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpMethodTest.java
index b2e5f6ad3964..810af16bef8e 100644
--- 
a/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpMethodTest.java
+++ 
b/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpMethodTest.java
@@ -70,6 +70,14 @@ public class VertxHttpMethodTest extends 
VertxHttpTestSupport {
         assertEquals(HttpMethod.DELETE.name(), result);
     }
 
+    @Test
+    public void testEndpointConfigurationPrecedenceOverHeader() {
+        // the header cannot override the method of the endpoint, as in 
camel-http
+        String result = template.requestBodyAndHeader(getProducerUri() + 
"?httpMethod=DELETE", null, Exchange.HTTP_METHOD,
+                HttpMethod.PUT.name(), String.class);
+        assertEquals(HttpMethod.DELETE.name(), result);
+    }
+
     @Test
     public void testHeaderConfigurationPrecedence() {
         String result = template.requestBodyAndHeader(getProducerUri() + 
"?foo=bar", null, Exchange.HTTP_METHOD,
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index e7fa909b25d1..11bdf44ac0b4 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -3449,3 +3449,10 @@ insert, and a collection of Strings ran a delete by id, 
even when the header or
 body decides only when neither is set, and a body that is a request of SolrJ, 
such as a `SolrQuery` or an
 `UpdateRequest`, still runs its own operation. The `CamelSolrQueryString` 
header makes a search only when no operation
 is set, and a `CamelSolrOperation` header with a value that is not an 
operation now fails.
+
+=== camel-vertx-http - the httpMethod option is not overridden by the 
CamelHttpMethod header
+
+The `httpMethod` option of the endpoint now wins over the `CamelHttpMethod` 
header, as its description says and as in
+camel-http. Before, the header overrode the option, so a route that received a 
request through an HTTP consumer, which
+sets the header to the method of that request, sent it on with that method 
instead of the method of the endpoint. To
+let the header choose the method, do not set `httpMethod` on the endpoint.

Reply via email to