Commits

Anonymous committed bfc1360 Merge

merge from bitbucket tip

  • Participants
  • Parent commits 3d7d826, 280e8f9

Comments (0)

Files changed (3)

File apps/riak/src/raw_http.hrl

 -define(Q_PROPS, "props").
 -define(Q_KEYS,  "keys").
 -define(Q_FALSE, "false").
+-define(Q_TRUE, "true").
 -define(Q_STREAM, "stream").
 -define(Q_VTAG,  "vtag").
+-define(Q_RETURNBODY, "returnbody").

File apps/riak/src/raw_http_resource.erl

     MDDoc = riak_object:update_metadata(VclockDoc, UserMetaMD),
     Doc = riak_object:update_value(MDDoc, wrq:req_body(RD)),
     ok = C:put(Doc, Ctx#ctx.w, Ctx#ctx.dw),
-    {true, RD, Ctx#ctx{doc={ok, Doc}}}.
+    {RD2, Ctx2} = case wrq:get_qs_value(?Q_RETURNBODY, RD) of
+                      ?Q_TRUE ->
+                          R = Ctx#ctx.r,
+                          DocCtx = Ctx#ctx{doc=C:get(B, K, R)},
+                          {Body, DocRD, DocCtx2} = produce_doc_body(RD, DocCtx),
+                          {wrq:append_to_response_body(Body, DocRD), DocCtx2};
+                      _ ->
+                          {RD, Ctx#ctx{doc={ok, Doc}}}
+                  end,
+    {true, RD2, Ctx2}.
 
 %% @spec extract_content_type(reqdata()) ->
 %%          {ContentType::string(), Charset::string()|undefined}

File client_lib/jiak.rb

     # and 'write_mask'
     def set_bucket_schema(bucket, schema)
       schema['required_fields'] ||= []
-      schema['read_mask']       ||= schema['required_fields']
+      schema['read_mask']       ||= schema['allowed_fields']
       schema['write_mask']      ||= schema['read_mask']
 
       do_req(set_data(Net::HTTP::Put.new(path(bucket)),