You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/02/21 07:31:02 UTC
[camel] branch camel-3.20.x updated: CAMEL-19078: Allow response headers with empty values to be returned
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.20.x by this push:
new 0373ead6b13 CAMEL-19078: Allow response headers with empty values to be returned
0373ead6b13 is described below
commit 0373ead6b13936814c24770bd2f04e021ae81d56
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Feb 20 10:47:24 2023 +0000
CAMEL-19078: Allow response headers with empty values to be returned
---
.../http/vertx/VertxPlatformHttpSupport.java | 2 +-
.../http/vertx/VertxPlatformHttpEngineTest.java | 33 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java
index 0a55082f21d..cef371bd0bf 100644
--- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java
+++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java
@@ -63,7 +63,7 @@ public final class VertxPlatformHttpSupport {
final String key = entry.getKey();
final Object value = entry.getValue();
// use an iterator as there can be multiple values. (must not use a delimiter)
- final Iterator<?> it = ObjectHelper.createIterator(value, null);
+ final Iterator<?> it = ObjectHelper.createIterator(value, null, true);
String firstValue = null;
List<String> values = null;
diff --git a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngineTest.java b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngineTest.java
index 9acaecdcf02..4e15f971341 100644
--- a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngineTest.java
+++ b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngineTest.java
@@ -681,6 +681,39 @@ public class VertxPlatformHttpEngineTest {
}
}
+ @Test
+ public void responseHeaders() throws Exception {
+ final CamelContext context = createCamelContext();
+
+ try {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("platform-http:/test")
+ .setHeader("nonEmptyFromRoute", constant("nonEmptyFromRouteValue"))
+ .setHeader("emptyFromRoute", constant(""))
+ .setBody().simple("Hello World");
+ }
+ });
+
+ context.start();
+
+ RestAssured.given()
+ .header("nonEmpty", "nonEmptyValue")
+ .header("empty", "")
+ .get("/test")
+ .then()
+ .statusCode(200)
+ .body(equalTo("Hello World"))
+ .header("nonEmpty", "nonEmptyValue")
+ .header("empty", "")
+ .header("nonEmptyFromRoute", "nonEmptyFromRouteValue")
+ .header("emptyFromRoute", "");
+ } finally {
+ context.stop();
+ }
+ }
+
static CamelContext createCamelContext() throws Exception {
return createCamelContext(null);
}