From 55b43e00a9276942b4dd06245701ff93dec3dc75 Mon Sep 17 00:00:00 2001 From: Jason David Davies Date: Tue, 13 Oct 2009 22:19:37 +0000 Subject: Fix new create_target replication option when OAuth is being used. Closes COUCHDB-525. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@824954 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_rep_httpc.erl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/couchdb') diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl index ba863746..bbc5ccec 100644 --- a/src/couchdb/couch_rep_httpc.erl +++ b/src/couchdb/couch_rep_httpc.erl @@ -74,18 +74,20 @@ db_exists(Req, CanonicalUrl, CreateDB) -> headers = Headers0, url = Url } = Req, - Headers = case proplists:get_value(<<"oauth">>, Auth) of - undefined -> - Headers0; - {OAuthProps} -> - [oauth_header(Url, [], head, OAuthProps) | Headers0] + HeadersFun = fun(Method) -> + case proplists:get_value(<<"oauth">>, Auth) of + undefined -> + Headers0; + {OAuthProps} -> + [oauth_header(Url, [], Method, OAuthProps) | Headers0] + end end, case CreateDB of true -> - catch ibrowse:send_req(Url, Headers, put); + catch ibrowse:send_req(Url, HeadersFun(put), put); _Else -> ok end, - case catch ibrowse:send_req(Url, Headers, head) of + case catch ibrowse:send_req(Url, HeadersFun(head), head) of {ok, "200", _, _} -> Req#http_db{url = CanonicalUrl}; {ok, "301", RespHeaders, _} -> -- cgit v1.2.3