anchor.diff:    put_dog(),
     DeleteRevId = delete_cat(CreateRevId),
   
  -  {200, R1} = test_lib:req(get, "/dbs/testdb/docs/_changes?history=all"),
  +  {200, R1} = req_changes("/dbs/testdb/docs/_changes?history=all"),
     A1 = jsx:decode(R1, [return_maps]),
     3 = maps:get(<<"last_seq">>, A1),
     Results1 = maps:get(<<"results">>, A1),
  
positive.code:   put_cat(),
    put_dog(),
  
    {200, R1} = test_lib:req(get, "/dbs/testdb/docs/_changes"),
    A1 = jsx:decode(R1, [return_maps]),
    2 = maps:get(<<"last_seq">>, A1),
    Results1 = maps:get(<<"results">>, A1),
    2 = length(Results1),
  
    {200, R2} = test_lib:req(get, "/dbs/testdb/docs/_changes?since=1"),
    A2 = jsx:decode(R2, [return_maps]),
    2 = maps:get(<<"last_seq">>, A2),
    Results2 = maps:get(<<"results">>, A2),
  
negative.code: %%=======================================================================
  
  reject_store_unknown(_Config) ->
    {400, _} = req_changes("/dbs/badstore/docs/_changes"),
    ok.
  
  reject_bad_params(_Config) ->
    {400, _} = req_changes("/dbs/testdb/docs/_changes?badparam=whatever"),
    ok.
  
  %%=======================================================================
  
  req_changes(Url) ->
    Headers = [{<<"Content-Type">>, <<"application/json">>},
               {<<"A-IM">>, <<"Incremental feed">>}],
    case hackney:request(get, Url, Headers, [], []) of
      {ok, Code, _Headers, Ref} ->
        {ok, Answer} = hackney:body(Ref),
        {Code, Answer};
      Error -> Error
    end.
  
  