Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Inline http_get/http_post/http_put helper functions

  • Loading branch information...
commit 84c88d4b563295efc45b2ff3f43b8396201b05d7 1 parent 3f1c28e
Tim Fletcher authored

Showing 1 changed file with 3 additions and 12 deletions. Show diff stats Hide diff stats

  1. +3 12 src/oauth.erl
15 src/oauth.erl
@@ -23,7 +23,7 @@ get(URL, ExtraParams, Consumer, Token, TokenSecret) ->
23 23
24 24 get(URL, ExtraParams, Consumer, Token, TokenSecret, HttpcOptions) ->
25 25 SignedParams = sign("GET", URL, ExtraParams, Consumer, Token, TokenSecret),
26   - http_get(uri(URL, SignedParams), HttpcOptions).
  26 + http_request(get, {uri(URL, SignedParams), []}, HttpcOptions).
27 27
28 28 post(URL, ExtraParams, Consumer) ->
29 29 post(URL, ExtraParams, Consumer, "", "").
@@ -33,14 +33,14 @@ post(URL, ExtraParams, Consumer, Token, TokenSecret) ->
33 33
34 34 post(URL, ExtraParams, Consumer, Token, TokenSecret, HttpcOptions) ->
35 35 SignedParams = sign("POST", URL, ExtraParams, Consumer, Token, TokenSecret),
36   - http_post(URL, uri_params_encode(SignedParams), HttpcOptions).
  36 + http_request(post, {URL, [], "application/x-www-form-urlencoded", uri_params_encode(SignedParams)}, HttpcOptions).
37 37
38 38 put(URL, ExtraParams, {ContentType, Body}, Consumer, Token, TokenSecret) ->
39 39 put(URL, ExtraParams, {ContentType, Body}, Consumer, Token, TokenSecret, []).
40 40
41 41 put(URL, ExtraParams, {ContentType, Body}, Consumer, Token, TokenSecret, HttpcOptions) ->
42 42 SignedParams = sign("PUT", URL, ExtraParams, Consumer, Token, TokenSecret),
43   - http_put(uri(URL, SignedParams), [], {ContentType, Body}, HttpcOptions).
  43 + http_request(put, {uri(URL, SignedParams), [], ContentType, Body}, HttpcOptions).
44 44
45 45 uri(Base, []) ->
46 46 Base;
@@ -180,15 +180,6 @@ params_encode(Params) ->
180 180 params_decode(_Response={{_, _, _}, _, Body}) ->
181 181 uri_params_decode(Body).
182 182
183   -http_get(URL, Options) ->
184   - http_request(get, {URL, []}, Options).
185   -
186   -http_post(URL, Data, Options) ->
187   - http_request(post, {URL, [], "application/x-www-form-urlencoded", Data}, Options).
188   -
189   -http_put(URL, Headers, {ContentType, Body}, Options) ->
190   - http_request(put, {URL, Headers, ContentType, Body}, Options).
191   -
192 183 http_request(Method, Request, Options) ->
193 184 httpc:request(Method, Request, [{autoredirect, false}], Options).
194 185

0 comments on commit 84c88d4

Please sign in to comment.
Something went wrong with that request. Please try again.