diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2020-10-05 15:25:12 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2020-10-05 15:56:03 -0400 |
commit | d560cb7c251f5f9a3c8a02138244ba3c0c4a9fe9 (patch) | |
tree | ee097675ac14f627caff842b5cef8c5e9c9842bf | |
parent | f143beb96546931314fe636cc485b1d4c84f0f4a (diff) | |
download | couchdb-d560cb7c251f5f9a3c8a02138244ba3c0c4a9fe9.tar.gz |
Keep auth properties as a map in replicator's httpdb record
Previously there was an attempt to keep backwards compatibility with 3.x
replicator plugins by transforming the auth into a proplist with
`maps:to_list/1`. However, that didn't account for nested properties, so we
could have ended up with a top level of props with maps for some values.
Instead of making things too complicating, and doing a nested transform to
proplists, just keep the auth object as a map and let the plugins handle the
compatibility issue.
-rw-r--r-- | src/couch_replicator/include/couch_replicator_api_wrap.hrl | 2 | ||||
-rw-r--r-- | src/couch_replicator/src/couch_replicator_api_wrap.erl | 2 | ||||
-rw-r--r-- | src/couch_replicator/src/couch_replicator_utils.erl | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/couch_replicator/include/couch_replicator_api_wrap.hrl b/src/couch_replicator/include/couch_replicator_api_wrap.hrl index 0f8213c51..6212ab412 100644 --- a/src/couch_replicator/include/couch_replicator_api_wrap.hrl +++ b/src/couch_replicator/include/couch_replicator_api_wrap.hrl @@ -14,7 +14,7 @@ -record(httpdb, { url, - auth_props = [], + auth_props = #{}, headers = [ {"Accept", "application/json"}, {"User-Agent", "CouchDB-Replicator/" ++ couch_server:get_version()} diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl index da6f28800..1df8ee0c7 100644 --- a/src/couch_replicator/src/couch_replicator_api_wrap.erl +++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl @@ -917,7 +917,7 @@ db_from_json(#{} = DbMap) -> end, #httpdb{ url = binary_to_list(Url), - auth_props = maps:to_list(Auth), + auth_props = Auth, headers = Headers, ibrowse_options = IBrowseOptions, timeout = Timeout, diff --git a/src/couch_replicator/src/couch_replicator_utils.erl b/src/couch_replicator/src/couch_replicator_utils.erl index cbed78ead..523de5f54 100644 --- a/src/couch_replicator/src/couch_replicator_utils.erl +++ b/src/couch_replicator/src/couch_replicator_utils.erl @@ -281,7 +281,10 @@ normalize_rep_test_() -> normalize_endpoint() -> HttpDb = #httpdb{ url = "http://host/db", - auth_props = [{"key", "val"}], + auth_props = #{ + "key" => "val", + "nested" => #{<<"other_key">> => "other_val"} + }, headers = [{"k2","v2"}, {"k1","v1"}], timeout = 30000, ibrowse_options = [{k2, v2}, {k1, v1}], |