Merge "Force header keys/values to bytes/unicode before coercing to unicode"
This commit is contained in:
commit
ba2ff4a6ea
@ -169,6 +169,8 @@ def http_log(args, kwargs, resp, body):
|
||||
|
||||
|
||||
def parse_header_string(data):
|
||||
if not isinstance(data, (six.text_type, six.binary_type)):
|
||||
data = str(data)
|
||||
if six.PY2:
|
||||
if isinstance(data, six.text_type):
|
||||
# Under Python2 requests only returns binary_type, but if we get
|
||||
|
@ -1203,13 +1203,16 @@ class TestPostObject(MockHttpTest):
|
||||
|
||||
def test_ok(self):
|
||||
c.http_connection = self.fake_http_connection(200)
|
||||
delete_at = 2.1 # not str! we don't know what other devs will use!
|
||||
args = ('http://www.test.com', 'token', 'container', 'obj',
|
||||
{'X-Object-Meta-Test': 'mymeta'})
|
||||
{'X-Object-Meta-Test': 'mymeta',
|
||||
'X-Delete-At': delete_at})
|
||||
c.post_object(*args)
|
||||
self.assertRequests([
|
||||
('POST', '/container/obj', '', {
|
||||
'x-auth-token': 'token',
|
||||
'X-Object-Meta-Test': 'mymeta'}),
|
||||
'X-Object-Meta-Test': 'mymeta',
|
||||
'X-Delete-At': delete_at}),
|
||||
])
|
||||
|
||||
def test_unicode_ok(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user