summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ceilometermiddleware/swift.py2
-rw-r--r--ceilometermiddleware/tests/test_swift.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/ceilometermiddleware/swift.py b/ceilometermiddleware/swift.py
index 8f27a1c..5877364 100644
--- a/ceilometermiddleware/swift.py
+++ b/ceilometermiddleware/swift.py
@@ -150,7 +150,7 @@ class Swift(object):
if header.startswith('HTTP_') and env[header]:
key = header[5:]
if isinstance(env[header], six.text_type):
- headers[key] = env[header].encode('utf-8')
+ headers[key] = six.text_type(env[header])
else:
headers[key] = str(env[header])
diff --git a/ceilometermiddleware/tests/test_swift.py b/ceilometermiddleware/tests/test_swift.py
index adfd167..2bb6e33 100644
--- a/ceilometermiddleware/tests/test_swift.py
+++ b/ceilometermiddleware/tests/test_swift.py
@@ -54,7 +54,7 @@ class FakeRequest(object):
if 'wsgi.input' not in environ:
environ['wsgi.input'] = six.moves.cStringIO('')
- for header, value in headers.iteritems():
+ for header, value in six.iteritems(headers):
environ['HTTP_%s' % header.upper()] = value
self.environ = environ
@@ -248,7 +248,7 @@ class TestSwift(tests_base.TestCase):
http_headers = [k for k in metadata.keys()
if k.startswith('http_header_')]
self.assertEqual(1, len(http_headers))
- self.assertEqual(uni.encode('utf-8'),
+ self.assertEqual(six.text_type(uni),
metadata['http_header_unicode'])
def test_metadata_headers_on_not_existing_header(self):