Merge "Object client adds content-length if PUT is empty"
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 69df472..c894612 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -34,8 +34,11 @@
def create_object(self, container, object_name, data):
"""Create storage object."""
+ headers = dict(self.headers)
+ if not data:
+ headers['content-length'] = '0'
url = "%s/%s" % (str(container), str(object_name))
- resp, body = self.put(url, data, self.headers)
+ resp, body = self.put(url, data, headers)
return resp, body
def update_object(self, container, object_name, data):
@@ -194,6 +197,8 @@
for key in metadata:
headers[str(key)] = metadata[key]
+ if not data:
+ headers['content-length'] = '0'
url = "%s/%s" % (str(container), str(object_name))
resp, body = self.put(url, data, headers=headers)
return resp, body