Skip to content

Commit

Permalink
Use XML export of simple forms of riak_cs_xml:to_xml instead of expor…
Browse files Browse the repository at this point in the history
…t_xml/1
  • Loading branch information
shino committed Feb 12, 2014
1 parent d35d74a commit d215335
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/riak_cs_mp_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ make_special_error(Code, Message, RequestId, HostId) ->
{'HostId', [HostId]}
]
},
riak_cs_xml:export_xml([XmlDoc]).
riak_cs_xml:to_xml([XmlDoc]).

list_multipart_uploads(Bucket, Caller, Opts) ->
list_multipart_uploads(Bucket, Caller, Opts, nopid).
Expand Down
2 changes: 1 addition & 1 deletion src/riak_cs_oos_response.erl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ invalid_digest_response(ContentMd5, RD, Ctx) ->
{'Content-MD5', [ContentMd5]},
{'HostId', ["host-id"]}
]},
Body = riak_cs_xml:export_xml([XmlDoc]),
Body = riak_cs_xml:to_xml([XmlDoc]),
UpdRD = wrq:set_resp_body(Body,
wrq:set_resp_header("Content-Type",
?XML_TYPE,
Expand Down
10 changes: 5 additions & 5 deletions src/riak_cs_s3_response.erl
Original file line number Diff line number Diff line change
Expand Up @@ -211,25 +211,25 @@ error_response(StatusCode, Code, Message, RD, Ctx) ->
{'Message', [Message]},
{'Resource', [string:strip(OrigResource, right, $/)]},
{'RequestId', [""]}]}],
respond(StatusCode, riak_cs_xml:export_xml(XmlDoc), RD, Ctx).
respond(StatusCode, riak_cs_xml:to_xml(XmlDoc), RD, Ctx).

copy_object_response(Manifest, RD, Ctx) ->
LastModified = riak_cs_wm_utils:to_iso_8601(Manifest?MANIFEST.created),
ETag = riak_cs_utils:etag_from_binary(Manifest?MANIFEST.content_md5),
XmlDoc = [{'CopyObjectResponse',
[{'LastModified', [LastModified]},
{'ETag', [ETag]}]}],
respond(200, riak_cs_xml:export_xml(XmlDoc), RD, Ctx).
respond(200, riak_cs_xml:to_xml(XmlDoc), RD, Ctx).

no_such_upload_response(UploadId, RD, Ctx) ->
XmlDoc = {'Error',
[
{'Code', [error_code(no_such_upload)]},
{'Message', [error_message(no_such_upload)]},
{'UploadId', [binary_to_list(base64url:encode(UploadId))]},
{'UploadId', [base64url:encode(UploadId)]},
{'HostId', ["host-id"]}
]},
Body = riak_cs_xml:export_xml([XmlDoc]),
Body = riak_cs_xml:to_xml([XmlDoc]),
respond(status_code(no_such_upload), Body, RD, Ctx).

invalid_digest_response(ContentMd5, RD, Ctx) ->
Expand All @@ -240,7 +240,7 @@ invalid_digest_response(ContentMd5, RD, Ctx) ->
{'Content-MD5', [ContentMd5]},
{'HostId', ["host-id"]}
]},
Body = riak_cs_xml:export_xml([XmlDoc]),
Body = riak_cs_xml:to_xml([XmlDoc]),
respond(status_code(invalid_digest), Body, RD, Ctx).

%% @doc Convert an error code string into its corresponding atom
Expand Down
4 changes: 2 additions & 2 deletions src/riak_cs_wm_usage.erl
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ produce_xml(RD, #ctx{body=undefined}=Ctx) ->
Storage = maybe_storage(RD, Ctx),
Doc = [{?KEY_USAGE, [{?KEY_ACCESS, xml_access(Access)},
{?KEY_STORAGE, xml_storage(Storage)}]}],
Body = case riak_cs_xml:export_xml(Doc) of
Body = case riak_cs_xml:to_xml(Doc) of
{error, Bin, _} -> Bin;
{incomplete, Bin, _} -> Bin;
Bin when is_binary(Bin) -> Bin
Expand Down Expand Up @@ -477,7 +477,7 @@ xml_error_msg(Message) when is_binary(Message) ->
xml_error_msg(binary_to_list(Message));
xml_error_msg(Message) ->
Doc = [{?KEY_ERROR, [{?KEY_MESSAGE, [Message]}]}],
riak_cs_xml:export_xml(Doc).
riak_cs_xml:to_xml(Doc).

%% @doc Produce a datetime tuple from a ISO8601 string
-spec datetime(binary()|string()) -> {ok, calendar:datetime()} | error.
Expand Down

0 comments on commit d215335

Please sign in to comment.