GH-39: Allow text/plain for SNS Inbound

Fixes GH-39 (https://github.com/spring-projects/spring-integration-aws/issues/39)

Amazon SNS HTTP notifications are sent with the `content-type` header as `text/plain`, not `application/json` as it is expected by the `MappingJackson2HttpMessageConverter` by default.

*Added `text/plain` as supported content type for SNS inbound notification

* Corrections after review
This commit is contained in:
Kamil Przerwa
2016-06-23 12:42:15 +01:00
committed by Artem Bilan
parent 0d52b9d352
commit 97988bdec5
2 changed files with 9 additions and 2 deletions

View File

@@ -54,6 +54,7 @@ import com.amazonaws.services.sns.AmazonSNS;
/**
* @author Artem Bilan
* @author Kamil Przerwa
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@@ -116,7 +117,7 @@ public class SnsInboundChannelAdapterTests {
this.mockMvc.perform(
post("/mySampleTopic")
.header("x-amz-sns-message-type", "Notification")
.contentType(MediaType.APPLICATION_JSON)
.contentType(MediaType.TEXT_PLAIN)
.content(StreamUtils.copyToByteArray(this.notificationMessage.getInputStream())))
.andExpect(status().isNoContent());
@@ -133,7 +134,7 @@ public class SnsInboundChannelAdapterTests {
this.mockMvc.perform(
post("/mySampleTopic")
.header("x-amz-sns-message-type", "UnsubscribeConfirmation")
.contentType(MediaType.APPLICATION_JSON)
.contentType(MediaType.TEXT_PLAIN)
.content(StreamUtils.copyToByteArray(this.unsubscribeConfirmation.getInputStream())))
.andExpect(status().isNoContent());