]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Response 204 when post on containers 3546/head
authorYuan Zhou <yuan.zhou@intel.com>
Fri, 30 Jan 2015 03:43:19 +0000 (11:43 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Fri, 30 Jan 2015 12:00:54 +0000 (20:00 +0800)
Currently POST request on container returns 202 if success. But in Swift
the code is 204. Let's use 204 to keep align with the Swift API.

Fixes #10667
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
src/rgw/rgw_rest_swift.cc

index f3852b9a842869dc4db0d30a4e30370f49a48ccd..bf869738330de880d73027a8240d379595948e68 100644 (file)
@@ -449,8 +449,13 @@ int RGWPutMetadata_ObjStore_SWIFT::get_params()
 
 void RGWPutMetadata_ObjStore_SWIFT::send_response()
 {
-  if (!ret)
-    ret = STATUS_ACCEPTED;
+  if (!ret) {
+    /* Return 204 when post metadata on a container */
+    if (s->object.empty())
+      ret = STATUS_NO_CONTENT;
+    else
+      ret = STATUS_ACCEPTED;
+  }
   set_req_state_err(s, ret);
   dump_errno(s);
   end_header(s, this);