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

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

commit 65bf69bed6220934ceb1fcb94bff6f68352b8a35
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Feb 19 10:13:22 2021 +0100

    camel-http - Small optimization
---
 .../org/apache/camel/component/http/HttpProducer.java     | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
index af521da..b79e354 100644
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
+++ 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
@@ -173,17 +173,10 @@ public class HttpProducer extends DefaultProducer {
                 Object headerValue = entry.getValue();
 
                 if (headerValue != null) {
-                    if (headerValue instanceof String) {
-                        // optimise for string values
-                        String value = (String) headerValue;
-                        if (!strategy.applyFilterToCamelHeaders(key, value, 
exchange)) {
-                            httpRequest.addHeader(key, value);
-                        }
-                        continue;
-                    } else if (headerValue instanceof Long || headerValue 
instanceof Integer
-                            || headerValue instanceof Boolean) {
-                        // optimise for other common types
-                        String value = tc.convertTo(String.class, exchange, 
headerValue);
+                    if (headerValue instanceof String || headerValue 
instanceof Integer || headerValue instanceof Long
+                            || headerValue instanceof Boolean || headerValue 
instanceof Date) {
+                        // optimise for common types
+                        String value = headerValue.toString();
                         if (!strategy.applyFilterToCamelHeaders(key, value, 
exchange)) {
                             httpRequest.addHeader(key, value);
                         }

Reply via email to