Merge "Improve swift headers handling"
This commit is contained in:
commit
57fbb72e32
@ -84,7 +84,10 @@ class BaseResource(resource.Resource):
|
||||
self.metadata = dict()
|
||||
|
||||
for header in headers:
|
||||
if header.startswith(self._custom_metadata_prefix):
|
||||
# RADOS and other stuff in front may actually lowcase headers
|
||||
if header.lower().startswith(
|
||||
self._custom_metadata_prefix.lower()
|
||||
):
|
||||
key = header[len(self._custom_metadata_prefix):].lower()
|
||||
self.metadata[key] = headers[header]
|
||||
|
||||
|
@ -116,6 +116,15 @@ class TestObject(base_test_object.BaseTestObject):
|
||||
self.assertEqual(self.headers['Content-Type'], sot.content_type)
|
||||
self.assertEqual(self.headers['X-Delete-At'], sot.delete_at)
|
||||
|
||||
# Verify that we also properly process lowcased headers
|
||||
# All headers are processed in _base._set_metadata therefore invoke it
|
||||
# here directly
|
||||
sot._set_metadata(headers={"x-object-meta-foo": "bar"})
|
||||
self.assert_no_calls()
|
||||
|
||||
# Attributes from header
|
||||
self.assertEqual("bar", sot.metadata["foo"])
|
||||
|
||||
def test_download(self):
|
||||
headers = {
|
||||
'X-Newest': 'True',
|
||||
|
Loading…
Reference in New Issue
Block a user