You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/25 19:33:52 UTC
[camel] branch master updated: Revert "camel-http - If payload is
byte[] then use byte array entity as its most optimal"
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new c98b572 Revert "camel-http - If payload is byte[] then use byte array entity as its most optimal"
c98b572 is described below
commit c98b572f69a8484bfa8f7aef0078bc408e11f208
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 25 20:33:18 2021 +0100
Revert "camel-http - If payload is byte[] then use byte array entity as its most optimal"
This reverts commit b91db4b410ba21552ee4ab0f483ea983dba75bd3.
---
.../java/org/apache/camel/component/http/HttpProducer.java | 10 +---------
1 file changed, 1 insertion(+), 9 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 39cf5f8..b789c40 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
@@ -676,12 +676,6 @@ public class HttpProducer extends DefaultProducer {
answer = new FileEntity(file);
}
}
- } else if (data instanceof byte[]) {
- ByteArrayEntity entity = new ByteArrayEntity((byte[]) data);
- if (contentType != null) {
- entity.setContentType(contentType.toString());
- }
- answer = entity;
} else if (data instanceof String) {
// be a bit careful with String as any type can most likely be converted to String
// so we only do an instanceof check and accept String if the body is really a String
@@ -696,9 +690,7 @@ public class HttpProducer extends DefaultProducer {
}
}
StringEntity entity = new StringEntity((String) data, charset);
- if (contentType != null) {
- entity.setContentType(contentType.toString());
- }
+ entity.setContentType(contentType != null ? contentType.toString() : null);
answer = entity;
}