Skip to content
Browse files

fixed ibrowse request to send_req

  • Loading branch information...
1 parent b4f225c commit 3472af3f89ad0c61bf473844ad5dbba0ef91dde8 @tsloughter committed Apr 2, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 src/ddb.erl
  2. +3 −3 src/ddb_aws.erl
View
2 src/ddb.erl
@@ -339,7 +339,7 @@ request(Target, JSON) ->
Body = jsx:to_json(JSON),
Headers = headers(Target, Body),
Opts = [{'response_format', 'binary'}],
- F = fun() -> ibrowse:request(?DDB_ENDPOINT, [{'Content-type', ?CONTENT_TYPE} | Headers], 'post', Body, Opts) end,
+ F = fun() -> ibrowse:send_req(?DDB_ENDPOINT, [{'Content-type', ?CONTENT_TYPE} | Headers], 'post', Body, Opts) end,
ddb_aws:retry(F, ?MAX_RETRIES, fun jsx:to_term/1).
-spec headers(string(), binary()) -> proplists:proplist().
View
6 src/ddb_aws.erl
@@ -48,12 +48,12 @@ retry(F, Max, N, H)
is_function(H) ->
backoff(N),
case F() of
- {'ok', {{_, 200, _}, _, Body}} ->
+ {'ok', "200", _, Body} ->
{'ok', H(Body)};
- {'ok', {{_, Code, _}, _, Body}} when Code >= 400 andalso Code =< 500 ->
+ {'ok', Code, _, Body} when Code >= "400" andalso Code =< "500" ->
ok = lager:error("Got client error (~s) ~p, aborting...", [Code, Body]),
{'error', H(Body)};
- {'ok', {{_, Code, _}, _, Body}} ->
+ {'ok', Code, _, Body} ->
ok = lager:warning("Unexpected response (~s) ~p, retrying...", [Code, Body]),
retry(F, Max, N + 1, H);
{'error', Error} ->

0 comments on commit 3472af3

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