gnodet-bot commented on code in PR #27689:
URL: https://github.com/apache/camel/pull/27689#discussion_r4243839039


##########
components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java:
##########
@@ -138,7 +140,18 @@ public void populateRequestHeaders(
                     continue;
                 }
 
-                if (!strategy.applyFilterToCamelHeaders(key, headerValue, 
exchange)) {
+                if (headerValue instanceof Iterable || headerValue instanceof 
Object[]) {
+                    // a collection or an object array has one value per 
element (must not use a delimiter, and allow
+                    // empty values); any other value, also a byte[] or 
another primitive array, is a single value
+                    final Iterator<?> it = 
org.apache.camel.support.ObjectHelper.createIterator(headerValue, null, true);
+                    HttpUtil.applyHeader(strategy, exchange, it, tc, key, 
(multiValues, prev) -> {
+                        if (multiValues != null) {
+                            headers.set(key, multiValues);
+                        } else if (prev != null) {
+                            headers.set(key, prev);

Review Comment:
   💡 **Edge case — empty collection:** When `headerValue` is an empty 
`Iterable` (e.g. `List.of()`), the iterator produces no elements, so the 
consumer is called with `(null, null)`. Neither branch here fires → no header 
is set. Previously `List.of().toString()` = `"[]"` would have been sent. This 
is arguably correct (empty = no values), but it's an undocumented behavior 
change — consider adding a test that asserts the header is not sent for an 
empty collection, or noting it in the upgrade guide.



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