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/12/06 08:48:32 UTC
[camel] branch main updated: CAMEL-17277 Do not try to auto-detect body mediatype then header is used (#6503)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 239c185 CAMEL-17277 Do not try to auto-detect body mediatype then header is used (#6503)
239c185 is described below
commit 239c185d5ee52995f2c1f7b2a9dad339768e1560
Author: henka-rl <67...@users.noreply.github.com>
AuthorDate: Mon Dec 6 09:47:57 2021 +0100
CAMEL-17277 Do not try to auto-detect body mediatype then header is used (#6503)
---
.../org/apache/camel/language/datasonnet/DatasonnetExpression.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetExpression.java b/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetExpression.java
index 76a969b..0bc7353 100644
--- a/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetExpression.java
+++ b/components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetExpression.java
@@ -35,6 +35,7 @@ import com.datasonnet.document.DefaultDocument;
import com.datasonnet.document.Document;
import com.datasonnet.document.MediaType;
import com.datasonnet.document.MediaTypes;
+import com.datasonnet.header.Header;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeExpressionException;
@@ -101,7 +102,7 @@ public class DatasonnetExpression extends ExpressionAdapter implements Expressio
private Document<?> doEvaluate(Exchange exchange) {
MediaType bodyMT = bodyMediaType;
- if (bodyMT == null) {
+ if (bodyMT == null && !expression.startsWith(Header.DATASONNET_HEADER)) {
//Try to auto-detect input mime type if it was not explicitly set
String typeHeader = exchange.getProperty(DatasonnetConstants.BODY_MEDIATYPE,
exchange.getIn().getHeader(Exchange.CONTENT_TYPE), String.class);