From 6e96c2b9eb552d62ee52955226dacc487dc92d4b Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Sun, 14 Sep 2014 18:40:08 +0100 Subject: [PATCH] Encode seq before sending request CouchDB 2.0 sequences are lists (of form [non_neg_integer(), binary()]) where previously they were strings (either as binary or as list) or numbers. The replicator calls iolist_to_binary on all parameters which scrambles this new format. Ensure we've JSON encoded the since value to a binary before calling send_req. --- src/couch_replicator_api_wrap.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/couch_replicator_api_wrap.erl b/src/couch_replicator_api_wrap.erl index ae4f16e..22a3b78 100644 --- a/src/couch_replicator_api_wrap.erl +++ b/src/couch_replicator_api_wrap.erl @@ -154,7 +154,7 @@ get_pending_count(#httpdb{} = Db, Seq) when is_number(Seq) -> end end); get_pending_count(#httpdb{} = Db, Seq) -> - Options = [{path, "_changes"}, {qs, [{"since", Seq}, {"limit", "0"}]}], + Options = [{path, "_changes"}, {qs, [{"since", ?JSON_ENCODE(Seq)}, {"limit", "0"}]}], send_req(Db, Options, fun(200, _, {Props}) -> {ok, couch_util:get_value(<<"pending">>, Props, null)} end);