diff --git a/SnsProducer.php b/SnsProducer.php index bbd46a9..3a6bd42 100644 --- a/SnsProducer.php +++ b/SnsProducer.php @@ -51,7 +51,7 @@ public function send(Destination $destination, Message $message): void 'MessageAttributes' => [ 'Headers' => [ 'DataType' => 'String', - 'StringValue' => json_encode([$message->getHeaders(), $message->getProperties()]), + 'StringValue' => base64_encode(json_encode([$message->getHeaders(), $message->getProperties()])), ], ], 'TopicArn' => $topicArn, diff --git a/Tests/SnsProducerTest.php b/Tests/SnsProducerTest.php index 5f87849..07f5e23 100644 --- a/Tests/SnsProducerTest.php +++ b/Tests/SnsProducerTest.php @@ -138,7 +138,7 @@ public function testShouldPublish() 'MessageAttributes' => [ 'Headers' => [ 'DataType' => 'String', - 'StringValue' => '[{"hkey":"hvaleu"},{"key":"value"}]', + 'StringValue' => base64_encode('[{"hkey":"hvaleu"},{"key":"value"}]'), ], ], 'TopicArn' => 'theTopicArn', @@ -189,7 +189,7 @@ public function testShouldPublishWithMergedAttributes() 'MessageAttributes' => [ 'Headers' => [ 'DataType' => 'String', - 'StringValue' => '[[],[]]', + 'StringValue' => base64_encode('[[],[]]'), ], 'Foo' => [ 'DataType' => 'String',