Add RawMessageDelivery for SNS subscriptions (fixes #1571)

This commit is contained in:
Daniel Birnstiel 2018-05-29 16:06:25 +02:00
commit 222cb1535c
2 changed files with 27 additions and 1 deletions

View file

@ -94,7 +94,10 @@ class Subscription(BaseModel):
if self.protocol == 'sqs':
queue_name = self.endpoint.split(":")[-1]
region = self.endpoint.split(":")[3]
enveloped_message = json.dumps(self.get_post_data(message, message_id, subject, message_attributes=message_attributes), sort_keys=True, indent=2, separators=(',', ': '))
if self.attributes.get('RawMessageDelivery') != 'true':
enveloped_message = json.dumps(self.get_post_data(message, message_id, subject, message_attributes=message_attributes), sort_keys=True, indent=2, separators=(',', ': '))
else:
enveloped_message = message
sqs_backends[region].send_message(queue_name, enveloped_message)
elif self.protocol in ['http', 'https']:
post_data = self.get_post_data(message, message_id, subject)