Skip to content

Commit

Permalink
Merge pull request #2 from onatskyy/base64
Browse files Browse the repository at this point in the history
base64 encode SNS Header message attribure
  • Loading branch information
onatskyy authored Sep 15, 2023
2 parents 337cb18 + ee6b3e5 commit 22d623a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SnsProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions Tests/SnsProducerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -189,7 +189,7 @@ public function testShouldPublishWithMergedAttributes()
'MessageAttributes' => [
'Headers' => [
'DataType' => 'String',
'StringValue' => '[[],[]]',
'StringValue' => base64_encode('[[],[]]'),
],
'Foo' => [
'DataType' => 'String',
Expand Down

0 comments on commit 22d623a

Please sign in to comment.