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
This commit is contained in:
Oleksii Chuprykov 2015-09-29 13:06:29 +03:00
parent 864181e522
commit a1b3c23ff8
1 changed files with 4 additions and 1 deletions

View File

@ -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