You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/09/08 07:58:01 UTC
[PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
oscerd opened a new pull request, #26183:
URL: https://github.com/apache/camel/pull/26183
## Issue
[CAMEL-24424](https://issues.apache.org/jira/browse/CAMEL-24424)
## Problem
`VertxHttpRestHeaderFilterStrategy.applyFilterToCamelHeaders()` delegated to the wrong super method:
```java
@Override
public boolean applyFilterToCamelHeaders(String headerName, Object headerValue, Exchange exchange) {
boolean answer = super.applyFilterToExternalHeaders(headerName, headerValue, exchange);
return filterCheck(templateUri, queryParameters, headerName, answer);
}
```
`applyFilterToExternalHeaders` consults the **inbound** filter, while the method implements the
**outbound** direction. `VertxHttpHeaderFilterStrategy.initialize()` only populates the *out* filter
(via `HttpUtil.addCommonFilters`), so on a REST producer that filter was never applied: a Camel
message header named `Content-Length`, `Transfer-Encoding`, `Host`, `Connection`, `Via`,
`Cache-Control`, `Date`, `Pragma`, `Trailer`, `Upgrade` or `Warning` was copied straight onto the
outgoing HTTP request.
The sibling REST strategies in `camel-http-common`, `camel-netty-http` and `camel-undertow` all
delegate to the matching super method â `vertx-http` was the only one left with the mismatch.
## Investigation
- The mismatch has been present since the class was introduced in `CAMEL-15283` (Vert.x HTTP client
component); it is a copy-paste slip, not a deliberate decision. `CAMEL-20163` later factored the
template/query token check out into `HttpUtil.filterCheck` but left the wrong delegation in place.
- A sweep of every `super.applyFilterTo*` call site across `components/`, `core/` and `dsl/` confirms
this was the last remaining direction mismatch.
- The strategy is only installed when the route does **not** supply its own `headerFilterStrategy`
(`VertxHttpComponent.createProducer`), so a custom strategy is unaffected.
## Fix
Delegate to `super.applyFilterToCamelHeaders(...)`, matching every sibling component.
## Test
`VertxHttpRestProducerHeaderFilterTest` drives a `rest:get:foo/{id}` producer bound to `vertx-http`
against an `undertow` test server and asserts what actually reaches the wire:
- `Via` and `Cache-Control` â excluded on the outbound direction, must not arrive
- `id` â consumed by the URI template, must not be sent as an HTTP header as well (guards the
existing `filterCheck` behaviour)
- `X-Custom` â not filtered on either direction, must arrive
Verified the test **fails before the fix** (`expected: null but was: "1.1 rogue-proxy"`) and passes
after it. Full `camel-vertx-http` suite: 91/91 green. Full reactor build clean, no regenerated
artifacts.
`camel-rest` is added in test scope so the REST producer path can be exercised, mirroring what
`camel-undertow` already declares for `UndertowProducerContentTypeTest`.
## Documentation
Behaviour change documented in `camel-4x-upgrade-guide-4_23.adoc`.
---
_Claude Code on behalf of oscerd_
đ¤ Generated with [Claude Code](https://claude.com/claude-code)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #26183:
URL: https://github.com/apache/camel/pull/26183#discussion_r3955728754
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
Review Comment:
Small convention point: `camel-vertx-http` is predominantly JUnit â 32 of its 35 test classes import `org.junit.jupiter.api.Assertions`, and only `VertxHttpTransferExceptionTest` uses AssertJ. `CLAUDE.md` ("Assertions: Use AssertJ When Possible") calls this out explicitly:
> Do NOT mix styles within a project/module. Check the assertion style already used by the other test classes in the component/module being touched: if they are predominantly JUnit assertions, write new tests in that same JUnit style rather than introducing AssertJ as an outlier.
So this one is better off in the module's existing JUnit style. Suggestions on this line and the three below cover the whole swap.
```suggestion
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
```
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VertxHttpRestProducerHeaderFilterTest extends VertxHttpTestSupport {
+
+ @Test
+ public void testRestProducerAppliesTheOutboundFilter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("id", "123");
+ headers.put("Via", "1.1 rogue-proxy");
+ headers.put("Cache-Control", "no-cache");
+ headers.put("X-Custom", "custom-value");
Review Comment:
Could you add `Content-Type` to this map (e.g. `application/json`) and assert below that it **does** still reach the server?
`content-type` is in `HttpUtil.addCommonFilters`, so after this fix it is filtered out of the header loop in `DefaultVertxHttpBinding.populateRequestHeaders` â the request only keeps it because the method sets it explicitly from `ExchangeHelper.getContentType(exchange)` a few lines earlier. That makes it the one header in the newly-applied set whose survival depends on a second, independent code path, and it is exactly what the upgrade guide promises ("the `Content-Type` of the request is still taken from the exchange as before"). Right now nothing pins that down, so a future change to that explicit block would silently break the most user-visible header without failing a test.
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VertxHttpRestProducerHeaderFilterTest extends VertxHttpTestSupport {
+
+ @Test
+ public void testRestProducerAppliesTheOutboundFilter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("id", "123");
+ headers.put("Via", "1.1 rogue-proxy");
+ headers.put("Cache-Control", "no-cache");
+ headers.put("X-Custom", "custom-value");
+
+ String out = template.requestBodyAndHeaders("direct:start", null, headers, String.class);
+ assertThat(out).isEqualTo("Hello World");
+
+ MockEndpoint.assertIsSatisfied(context);
+
+ Message received = mock.getReceivedExchanges().get(0).getMessage();
+ // excluded on the outbound direction by the common HTTP filter set, so they must not reach the wire
+ assertThat(received.getHeader("Via")).isNull();
+ assertThat(received.getHeader("Cache-Control")).isNull();
+ // already consumed by the uri template, so it must not be sent as an HTTP header as well
+ assertThat(received.getHeader("id")).isNull();
+ // not filtered on either direction
+ assertThat(received.getHeader("X-Custom")).isEqualTo("custom-value");
Review Comment:
```suggestion
// excluded on the outbound direction by the common HTTP filter set, so they must not reach the wire
assertNull(received.getHeader("Via"));
assertNull(received.getHeader("Cache-Control"));
// already consumed by the uri template, so it must not be sent as an HTTP header as well
assertNull(received.getHeader("id"));
// not filtered on either direction
assertEquals("custom-value", received.getHeader("X-Custom"));
```
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VertxHttpRestProducerHeaderFilterTest extends VertxHttpTestSupport {
+
+ @Test
+ public void testRestProducerAppliesTheOutboundFilter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("id", "123");
+ headers.put("Via", "1.1 rogue-proxy");
+ headers.put("Cache-Control", "no-cache");
+ headers.put("X-Custom", "custom-value");
+
+ String out = template.requestBodyAndHeaders("direct:start", null, headers, String.class);
+ assertThat(out).isEqualTo("Hello World");
Review Comment:
```suggestion
assertEquals("Hello World", out);
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #26183:
URL: https://github.com/apache/camel/pull/26183
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632216529
<!-- camel-backport-bot -->
### đ Backport Bot
**Conflicts (đ¤ agent dispatched to resolve):**
- â ī¸ `camel-4.22.x` â Command failed: git remote add fork https://github.com/gnodet-bot/camel.git
error: remote fork already exists.
- â ī¸ `camel-4.18.x` â Command failed: git remote add fork https://github.com/gnodet-bot/camel.git
error: remote fork already exists.
âšī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632286596
<!-- camel-backport-bot -->
### đ Backport Bot
**Conflicts (đ¤ agent dispatched to resolve):**
- â ī¸ `camel-4.22.x` â Cherry-pick conflict in: docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
- â ī¸ `camel-4.18.x` â Cherry-pick conflict in: docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
âšī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #26183:
URL: https://github.com/apache/camel/pull/26183#discussion_r3955931203
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
Review Comment:
The module's 50 existing test classes all use JUnit assertions (`org.junit.jupiter.api.Assertions`); zero use AssertJ. CLAUDE.md calls this out explicitly: match the module's existing style rather than introducing AssertJ as an outlier. Swap the import and all four usages below.
```suggestion
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
```
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VertxHttpRestProducerHeaderFilterTest extends VertxHttpTestSupport {
+
+ @Test
+ public void testRestProducerAppliesTheOutboundFilter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("id", "123");
+ headers.put("Via", "1.1 rogue-proxy");
+ headers.put("Cache-Control", "no-cache");
+ headers.put("X-Custom", "custom-value");
+
+ String out = template.requestBodyAndHeaders("direct:start", null, headers, String.class);
+ assertThat(out).isEqualTo("Hello World");
Review Comment:
```suggestion
assertEquals("Hello World", out);
```
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VertxHttpRestProducerHeaderFilterTest extends VertxHttpTestSupport {
+
+ @Test
+ public void testRestProducerAppliesTheOutboundFilter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("id", "123");
+ headers.put("Via", "1.1 rogue-proxy");
+ headers.put("Cache-Control", "no-cache");
+ headers.put("X-Custom", "custom-value");
Review Comment:
Add `Content-Type` here (e.g. `headers.put("Content-Type", "application/json")`) and assert below that it **still arrives** at the server.
`content-type` is in `HttpUtil.addCommonFilters`, so after this fix it enters the filter loop in `DefaultVertxHttpBinding.populateRequestHeaders` and would be dropped â except that method sets it explicitly from `ExchangeHelper.getContentType(exchange)` a few lines earlier, before the loop runs. That explicit assignment is what the upgrade guide promises ("the `Content-Type` of the request is still taken from the exchange as before"), but nothing in the test locks this invariant down. A future refactor of `populateRequestHeaders` that removes the explicit assignment would silently break `Content-Type` propagation without failing any test.
##########
components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRestProducerHeaderFilterTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.vertx.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Message;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VertxHttpRestProducerHeaderFilterTest extends VertxHttpTestSupport {
+
+ @Test
+ public void testRestProducerAppliesTheOutboundFilter() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("id", "123");
+ headers.put("Via", "1.1 rogue-proxy");
+ headers.put("Cache-Control", "no-cache");
+ headers.put("X-Custom", "custom-value");
+
+ String out = template.requestBodyAndHeaders("direct:start", null, headers, String.class);
+ assertThat(out).isEqualTo("Hello World");
+
+ MockEndpoint.assertIsSatisfied(context);
+
+ Message received = mock.getReceivedExchanges().get(0).getMessage();
+ // excluded on the outbound direction by the common HTTP filter set, so they must not reach the wire
+ assertThat(received.getHeader("Via")).isNull();
+ assertThat(received.getHeader("Cache-Control")).isNull();
+ // already consumed by the uri template, so it must not be sent as an HTTP header as well
+ assertThat(received.getHeader("id")).isNull();
+ // not filtered on either direction
+ assertThat(received.getHeader("X-Custom")).isEqualTo("custom-value");
Review Comment:
```suggestion
// excluded on the outbound direction by the common HTTP filter set, so they must not reach the wire
assertNull(received.getHeader("Via"));
assertNull(received.getHeader("Cache-Control"));
// already consumed by the uri template, so it must not be sent as an HTTP header as well
assertNull(received.getHeader("id"));
// not filtered on either direction
assertEquals("custom-value", received.getHeader("X-Custom"));
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5582189758
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `components/camel-vertx/camel-vertx-http`
- `docs`
---
<details><summary>:microscope: Scalpel shadow comparison â Scalpel: 22 tested, 26 compile-only â current: 21 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **48 affected modules** (current approach: 21).
<details><summary>:warning: Modules only in Scalpel (27)</summary>
- `apache-camel`
- `camel-allcomponents`
- `camel-catalog`
- `camel-catalog-console`
- `camel-catalog-maven`
- `camel-catalog-suggest`
- `camel-componentdsl`
- `camel-endpointdsl`
- `camel-endpointdsl-support`
- `camel-itest`
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-kamelet-main`
- `camel-launcher`
- `camel-report-maven-plugin`
- `camel-route-parser`
- `camel-yaml-dsl`
- `camel-yaml-dsl-deserializers`
- `camel-yaml-dsl-maven-plugin`
- `coverage`
- `docs`
- `dummy-component`
</details>
**Skip-tests mode would test 22 modules** (2 direct + 20 downstream), **skip tests for 26** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (22)</summary>
- `camel-a2a`
- `camel-jbang-mcp`
- `camel-jbang-plugin-mcp`
- `camel-jbang-plugin-route-parser`
- `camel-jbang-plugin-tui`
- `camel-jbang-plugin-validate`
- `camel-jsonpath`
- `camel-knative-http`
- `camel-launcher-container`
- `camel-mcp-server`
- `camel-micrometer-prometheus`
- `camel-oauth`
- `camel-observability-services`
- `camel-openapi-validator`
- `camel-platform-http-main`
- `camel-platform-http-vertx`
- `camel-rest-openapi`
- `camel-rest-postman`
- `camel-vertx-http`
- `camel-yaml-dsl-validator`
- `camel-yaml-dsl-validator-maven-plugin`
- `docs`
</details>
<details><summary>Modules with tests skipped (26)</summary>
- `apache-camel`
- `camel-allcomponents`
- `camel-catalog`
- `camel-catalog-console`
- `camel-catalog-maven`
- `camel-catalog-suggest`
- `camel-componentdsl`
- `camel-endpointdsl`
- `camel-endpointdsl-support`
- `camel-itest`
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-kamelet-main`
- `camel-launcher`
- `camel-report-maven-plugin`
- `camel-route-parser`
- `camel-yaml-dsl`
- `camel-yaml-dsl-deserializers`
- `camel-yaml-dsl-maven-plugin`
- `coverage`
- `dummy-component`
</details>
> :information_source: Shadow mode â Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
<details><summary>All tested modules (48 modules, 8m 13s total)</summary>
**Total reactor time:** 8m 13s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 51.5s | SUCCESS |
| Camel :: AI :: MCP Server | 46.2s | SUCCESS |
| Camel :: JBang :: MCP | 39.7s | SUCCESS |
| Camel :: Knative HTTP | 37.0s | SUCCESS |
| Camel :: Component DSL | 27.6s | SUCCESS |
| Camel :: REST OpenApi | 22.6s | SUCCESS |
| Camel :: OAuth | 22.0s | SUCCESS |
| Camel :: JBang :: Plugin :: TUI | 21.9s | SUCCESS |
| Camel :: Platform HTTP :: Vert.x | 20.7s | SUCCESS |
| Camel :: AI :: A2A | 18.9s | SUCCESS |
| Camel :: JSon Path | 17.5s | SUCCESS |
| Camel :: Vert.x :: HTTP | 16.1s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 15.9s | SUCCESS |
| Camel :: Docs | 14.7s | SUCCESS |
| Camel :: Catalog :: Camel Catalog | 14.6s | SUCCESS |
| Camel :: REST Postman | 12.8s | SUCCESS |
| Camel :: Platform HTTP :: Main | 12.5s | SUCCESS |
| Camel :: OpenAPI :: Validator | 8.8s | SUCCESS |
| Camel :: Kamelet Main | 8.5s | SUCCESS |
| Camel :: Catalog :: Camel Report Maven Plugin | 8.4s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 7.7s | SUCCESS |
| Camel :: Catalog :: Camel Route Parser | 7.4s | SUCCESS |
| Camel :: YAML DSL :: Deserializers | 6.3s | SUCCESS |
| Camel :: All Components Sync point | 4.6s | SUCCESS |
| Camel :: YAML DSL :: Validator | 4.6s | SUCCESS |
| Camel :: Catalog :: Suggest | 3.0s | SUCCESS |
| Camel :: YAML DSL :: Validator Maven Plugin | 2.7s | SUCCESS |
| Camel :: YAML DSL :: Maven Plugins | 2.5s | SUCCESS |
| Camel :: Catalog :: Maven | 2.3s | SUCCESS |
| Camel :: Assembly | 1.6s | SUCCESS |
| Camel :: Micrometer :: Prometheus | 1.4s | SUCCESS |
| Camel :: JBang :: Main | 1.4s | SUCCESS |
| Camel :: Coverage | 1.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.2s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.2s | SUCCESS |
| Camel :: Endpoint DSL :: Support | 0.9s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 0.9s | SUCCESS |
| Camel :: Catalog :: Console | 0.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.7s | SUCCESS |
| Camel :: Launcher :: Container | 0.7s | SUCCESS |
| Camel :: JBang :: Integration tests | 0.6s | SUCCESS |
| Camel :: Catalog :: Dummy Component | 0.5s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 0.5s | SUCCESS |
| Camel :: Observability Services | 0.5s | SUCCESS |
| Camel :: Endpoint DSL | n/a | |
| Camel :: Integration Tests | n/a | |
| Camel :: JBang :: Core | n/a | |
| Camel :: YAML DSL | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (51.5s)
- `Camel :: AI :: MCP Server` (46.2s)
- `Camel :: JBang :: MCP` (39.7s)
- `Camel :: Knative HTTP` (37.0s)
- `Camel :: Component DSL` (27.6s)
- `Camel :: REST OpenApi` (22.6s)
- `Camel :: OAuth` (22.0s)
- `Camel :: JBang :: Plugin :: TUI` (21.9s)
- `Camel :: Platform HTTP :: Vert.x` (20.7s)
- `Camel :: AI :: A2A` (18.9s)
- `Camel :: JSon Path` (17.5s)
- `Camel :: Vert.x :: HTTP` (16.1s)
- `Camel :: JBang :: Plugin :: Kubernetes` (15.9s)
- `Camel :: Docs` (14.7s)
- `Camel :: Catalog :: Camel Catalog` (14.6s)
- `Camel :: REST Postman` (12.8s)
- `Camel :: Platform HTTP :: Main` (12.5s)
- `Camel :: OpenAPI :: Validator` (8.8s)
- `Camel :: Kamelet Main` (8.5s)
- `Camel :: Catalog :: Camel Report Maven Plugin` (8.4s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/34201993881)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632081172
â
Backport to `camel-4.22.x` created: https://github.com/apache/camel/pull/26323
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632487556
â
Backport to `camel-4.18.x` created: https://github.com/apache/camel/pull/26325
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632283354
<!-- camel-backport-bot -->
### đ Backport Bot
**Conflicts (đ¤ agent dispatched to resolve):**
- â ī¸ `camel-4.22.x` â Cherry-pick conflict in: docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
- â ī¸ `camel-4.18.x` â Cherry-pick conflict in: docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
âšī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5582567261
Thanks @davsclaus @gnodet â both points addressed in e3f7d0a:
- **JUnit assertions**: switched `VertxHttpRestProducerHeaderFilterTest` from AssertJ to JUnit (`assertEquals`/`assertNull`) to match the module's existing style, including your `assertEquals("Hello World", out)` and the `assertNull` suggestions for `Via`/`Cache-Control`.
- **Content-Type coverage**: added `Content-Type: application/json` to the request and assert it **still reaches the server**. Exactly as you described â it's in `HttpUtil.addCommonFilters`, but `DefaultVertxHttpBinding.populateRequestHeaders` sets it explicitly from `ExchangeHelper.getContentType()` before the filter loop runs, so it survives. The test now pins that invariant (verified locally: it arrives as `application/json`), so a future refactor that drops the explicit assignment would fail here instead of silently breaking the most user-visible header.
_Claude Code on behalf of Andrea Cosentino_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632046023
<!-- camel-backport-bot -->
### đ Backport Bot
**Conflicts (đ¤ agent dispatched to resolve):**
- â ī¸ `camel-4.22.x` â Cherry-pick conflict in: docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
- â ī¸ `camel-4.18.x` â Cherry-pick conflict in: docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
âšī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632220347
<!-- camel-backport-bot -->
### đ Backport Bot
**Conflicts (đ¤ agent dispatched to resolve):**
- â ī¸ `camel-4.22.x` â Command failed: git remote add fork https://github.com/gnodet-bot/camel.git
error: remote fork already exists.
- â ī¸ `camel-4.18.x` â Command failed: git remote add fork https://github.com/gnodet-bot/camel.git
error: remote fork already exists.
âšī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5632090507
âī¸ Backport to `camel-4.18.x` **skipped**: the bug (calling `super.applyFilterToExternalHeaders` instead of `super.applyFilterToCamelHeaders` in `VertxHttpRestHeaderFilterStrategy`) does not exist on `camel-4.18.x` â that branch already has the correct delegation. The regression was introduced on `main` only. The test and pom.xml changes from this PR are also already present on `camel-4.18.x`.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5581417602
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24424: camel-vertx-http - apply the outbound header filter on the REST producer [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #26183:
URL: https://github.com/apache/camel/pull/26183#issuecomment-5584455682
<!-- camel-backport-bot -->
### đ Backport Bot
This bugfix was merged into `main` and may need porting to:
- `camel-4.22.x`
- `camel-4.18.x`
Labels `port/<branch>` have been added. Remove a label to opt out of porting to that branch.
Port PRs will be created shortly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org