diff --git a/moto/core/responses.py b/moto/core/responses.py index 2d0e485ba..a5a1f3880 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -125,6 +125,7 @@ class BaseResponse(_TemplateEnvironmentMixin): for key, value in request.form.items(): querystring[key] = [value, ] + raw_body = self.body if isinstance(self.body, six.binary_type): self.body = self.body.decode('utf-8') @@ -143,7 +144,7 @@ class BaseResponse(_TemplateEnvironmentMixin): for key, value in flat.items(): querystring[key] = [value] elif self.body: - querystring.update(parse_qs(self.body, keep_blank_values=True)) + querystring.update(parse_qs(raw_body, keep_blank_values=True)) if not querystring: querystring.update(headers) diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py index 2889e520f..0df4c2dc9 100644 --- a/tests/test_sqs/test_sqs.py +++ b/tests/test_sqs/test_sqs.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import unicode_literals import boto @@ -54,6 +55,20 @@ def test_message_send(): messages.should.have.length_of(1) +@mock_sqs +def test_send_message_with_unicode_characters(): + body_one = 'Héllo!😀' + + sqs = boto3.resource('sqs', region_name='us-east-1') + queue = sqs.create_queue(QueueName="blah") + msg = queue.send_message(MessageBody=body_one) + + messages = queue.receive_messages() + message_body = messages[0].body + + message_body.should.equal(body_one) + + @mock_sqs def test_set_queue_attributes(): sqs = boto3.resource('sqs', region_name='us-east-1')