Add missing content-length header
This patch adds missing content-length header param into swift_upload_object() method. Without it object upload handling could be failed with "411 Length Required" error if Ceph is used as an object storage. Change-Id: Id0813806abb36a6f015efd13ec987492a3701476 Closes-Bug: #1352256
This commit is contained in:
parent
e9b4ad259d
commit
8201d65cf9
@ -286,6 +286,7 @@ def swift_upload_object(request, container_name, object_name,
|
||||
etag = swift_api(request).put_object(container_name,
|
||||
object_name,
|
||||
object_file,
|
||||
content_length=size,
|
||||
headers=headers)
|
||||
|
||||
obj_info = {'name': object_name, 'bytes': size, 'etag': etag}
|
||||
|
@ -184,16 +184,18 @@ class SwiftApiTests(test.APITestCase):
|
||||
headers = {'X-Object-Meta-Orig-Filename': fake_name}
|
||||
|
||||
swift_api = self.stub_swiftclient()
|
||||
test_file = FakeFile()
|
||||
swift_api.put_object(container.name,
|
||||
obj.name,
|
||||
IsA(FakeFile),
|
||||
content_length=test_file.size,
|
||||
headers=headers)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.swift.swift_upload_object(self.request,
|
||||
container.name,
|
||||
obj.name,
|
||||
FakeFile())
|
||||
test_file)
|
||||
|
||||
def test_swift_upload_object_without_file(self):
|
||||
container = self.containers.first()
|
||||
@ -203,6 +205,7 @@ class SwiftApiTests(test.APITestCase):
|
||||
swift_api.put_object(container.name,
|
||||
obj.name,
|
||||
None,
|
||||
content_length=0,
|
||||
headers={})
|
||||
self.mox.ReplayAll()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user