From 74c8f65342088de58df7315494c7fa39bce37e33 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Tue, 12 Apr 2016 12:01:39 +0300 Subject: [PATCH] Use utils.convert_str to convert HTTP header values This patch removes duplicate code between wsgi.py and utils.py modules. Change-Id: Ic3eefc2bc28ff202324e7859102b289aac7974d4 --- cinder/api/openstack/wsgi.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cinder/api/openstack/wsgi.py b/cinder/api/openstack/wsgi.py index 67a54cb373f..ed93b6caef6 100644 --- a/cinder/api/openstack/wsgi.py +++ b/cinder/api/openstack/wsgi.py @@ -25,7 +25,6 @@ from lxml import etree from oslo_log import log as logging from oslo_log import versionutils from oslo_serialization import jsonutils -from oslo_utils import encodeutils from oslo_utils import excutils from oslo_utils import strutils import six @@ -1166,13 +1165,7 @@ class Resource(wsgi.Application): if hasattr(response, 'headers'): for hdr, val in response.headers.items(): # Headers must be utf-8 strings - if six.PY2: - val = encodeutils.to_utf8(val) - else: - if isinstance(val, bytes): - val = val.decode('utf-8') - else: - val = str(val) + val = utils.convert_str(val) response.headers[hdr] = val