From 4d74212932856a7d269ce155679715979df9a423 Mon Sep 17 00:00:00 2001 From: Marius Bogoevici Date: Sun, 18 Dec 2016 21:10:34 -0500 Subject: [PATCH] Skip `deserializePayloadIfNecessary` only if `originalContentType` is not set Fixes #741 The current code will skip `deserializePayloadIfNecessary` if the payload is a `byte[]`. There are in fact two conditions that indicate that a message does not require postprocessing in the binder: that the payload is not a `byte[]` which indicates that the message has already been deserialized, and that the `originalContentType` is not present, or else it'd need to be moved to `contentType`. This fix adds the secondary condition to the check. --- .../cloud/stream/binder/AbstractMessageChannelBinder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java index 3aac7c84d..db24919d0 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java @@ -278,7 +278,8 @@ public abstract class AbstractMessageChannelBinder requestMessage) { - if (!(requestMessage.getPayload() instanceof byte[])) { + if (!(requestMessage.getPayload() instanceof byte[]) + && !requestMessage.getHeaders().containsKey(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)) { return requestMessage; } MessageValues messageValues;