From a1b3c23ff856ed2574a1ab50ba854f6a79b3213e Mon Sep 17 00:00:00 2001 From: Oleksii Chuprykov Date: Tue, 29 Sep 2015 13:06:29 +0300 Subject: [PATCH] Encode Location header in utf-8 We get Location header in unicode format. Need to encode it to utf-8 format, otherwise heat won't work on some requests running via mod_wsgi. Closes-Bug: #1500807 Change-Id: I8950360e71cd62baf899d0aff822b981b5d99068 --- heat/api/openstack/v1/stacks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/heat/api/openstack/v1/stacks.py b/heat/api/openstack/v1/stacks.py index db5fcdf4bd..e54154d763 100644 --- a/heat/api/openstack/v1/stacks.py +++ b/heat/api/openstack/v1/stacks.py @@ -618,7 +618,10 @@ class StackSerializer(serializers.JSONResponseSerializer): def _populate_response_header(self, response, location, status): response.status = status - response.headers['Location'] = location + if six.PY2: + response.headers['Location'] = location.encode('utf-8') + else: + response.headers['Location'] = location response.headers['Content-Type'] = 'application/json' return response