summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-07-28 17:08:15 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 11:21:00 -0400
commit3e3d587680b86b79115ebef386296309e562ba1d (patch)
tree5c32789350ed4cd086a3d81dd806634bd2f55b2c
parente353d40c50b2355129f283bff2165da0b3a05d1c (diff)
convert all replication requests into remote/remote
-rw-r--r--src/chttpd_misc.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/chttpd_misc.erl b/src/chttpd_misc.erl
index a6cbd520..77d40b16 100644
--- a/src/chttpd_misc.erl
+++ b/src/chttpd_misc.erl
@@ -105,15 +105,19 @@ handle_task_status_req(#httpd{method='GET'}=Req) ->
handle_task_status_req(Req) ->
send_method_not_allowed(Req, "GET,HEAD").
-handle_replicate_req(#httpd{method='POST'}=Req) ->
+handle_replicate_req(#httpd{method='POST', user_ctx=Ctx} = Req) ->
PostBody = get(post_body),
- try showroom_rep:replicate(PostBody, Req#httpd.user_ctx) of
+ try couch_rep:replicate(PostBody, Ctx) of
{ok, {continuous, RepId}} ->
send_json(Req, 202, {[{ok, true}, {<<"_local_id">>, RepId}]});
+ {ok, {cancelled, RepId}} ->
+ send_json(Req, 200, {[{ok, true}, {<<"_local_id">>, RepId}]});
{ok, {JsonResults}} ->
send_json(Req, {[{ok, true} | JsonResults]});
{error, {Type, Details}} ->
send_json(Req, 500, {[{error, Type}, {reason, Details}]});
+ {error, not_found} ->
+ send_json(Req, 404, {[{error, not_found}]});
{error, Reason} ->
send_json(Req, 500, {[{error, Reason}]})
catch