You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/17 23:57:24 UTC

[20/50] git commit: Allow httpc options to be passed through.

Allow httpc options to be passed through.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-oauth/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-oauth/commit/6b012def
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-oauth/tree/6b012def
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-oauth/diff/6b012def

Branch: refs/heads/import
Commit: 6b012def4e49d867e9255de26ef7273a3db27bd5
Parents: 24a39a2
Author: Tim Fletcher <ma...@tfletcher.com>
Authored: Fri Nov 26 14:41:20 2010 +0000
Committer: Tim Fletcher <ma...@tfletcher.com>
Committed: Fri Nov 26 14:41:20 2010 +0000

----------------------------------------------------------------------
 src/oauth.erl      | 12 ++++++++++--
 src/oauth_http.erl | 16 +++++++++++-----
 2 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-oauth/blob/6b012def/src/oauth.erl
----------------------------------------------------------------------
diff --git a/src/oauth.erl b/src/oauth.erl
index 866655c..70770ba 100644
--- a/src/oauth.erl
+++ b/src/oauth.erl
@@ -2,8 +2,10 @@
 
 -export(
   [ get/5
+  , get/6
   , header/1
   , post/5
+  , post/6
   , signature/5
   , signature_base_string/3
   , signed_params/6
@@ -15,12 +17,18 @@
 
 
 get(URL, ExtraParams, Consumer, Token, TokenSecret) ->
+  get(URL, ExtraParams, Consumer, Token, TokenSecret, []).
+
+get(URL, ExtraParams, Consumer, Token, TokenSecret, HttpcOptions) ->
   SignedParams = signed_params("GET", URL, ExtraParams, Consumer, Token, TokenSecret),
-  oauth_http:get(uri(URL, SignedParams)).
+  oauth_http:get(uri(URL, SignedParams), HttpcOptions).
 
 post(URL, ExtraParams, Consumer, Token, TokenSecret) ->
+  post(URL, ExtraParams, Consumer, Token, TokenSecret, []).
+
+post(URL, ExtraParams, Consumer, Token, TokenSecret, HttpcOptions) ->
   SignedParams = signed_params("POST", URL, ExtraParams, Consumer, Token, TokenSecret),
-  oauth_http:post(URL, oauth_uri:params_to_string(SignedParams)).
+  oauth_http:post(URL, oauth_uri:params_to_string(SignedParams), HttpcOptions).
 
 uri(Base, []) ->
   Base;

http://git-wip-us.apache.org/repos/asf/couchdb-oauth/blob/6b012def/src/oauth_http.erl
----------------------------------------------------------------------
diff --git a/src/oauth_http.erl b/src/oauth_http.erl
index 92c806c..32261d3 100644
--- a/src/oauth_http.erl
+++ b/src/oauth_http.erl
@@ -1,16 +1,22 @@
 -module(oauth_http).
 
--export([get/1, post/2, response_params/1, response_body/1, response_code/1]).
+-export([get/1, get/2, post/2, post/3, response_params/1, response_body/1, response_code/1]).
 
 
 get(URL) ->
-  request(get, {URL, []}).
+  get(URL, []).
+
+get(URL, Options) ->
+  request(get, {URL, []}, Options).
 
 post(URL, Data) ->
-  request(post, {URL, [], "application/x-www-form-urlencoded", Data}).
+  post(URL, Data, []).
+
+post(URL, Data, Options) ->
+  request(post, {URL, [], "application/x-www-form-urlencoded", Data}, Options).
 
-request(Method, Request) ->
-  httpc:request(Method, Request, [{autoredirect, false}], []).
+request(Method, Request, Options) ->
+  httpc:request(Method, Request, [{autoredirect, false}], Options).
 
 response_params(Response) ->
   oauth_uri:params_from_string(response_body(Response)).