1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-module(oauth_http).
-export([get/1, post/2, response_params/1, response_body/1, response_code/1]).
get(URL) ->
request(get, {URL, []}).
post(URL, Data) ->
request(post, {URL, [], "application/x-www-form-urlencoded", Data}).
request(Method, Request) ->
http:request(Method, Request, [{autoredirect, false}], []).
response_params(Response) ->
oauth_uri:params_from_string(response_body(Response)).
response_body({{_, _, _}, _, Body}) ->
Body.
response_code({{_, Code, _}, _, _}) ->
Code.
|