diff options
| -rw-r--r-- | src/chttpd_misc.erl | 8 | 
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 | 
