Skip to content

Commit

Permalink
Only call iolist_to_binary once
Browse files Browse the repository at this point in the history
  • Loading branch information
puzza007 committed Jul 7, 2015
1 parent 5378bea commit c4b7e2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hackney_client/hackney_request.erl
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ handle_body(Headers, ReqType0, Body0, Client) ->

_ when is_list(Body0) -> % iolist case
Body1 = iolist_to_binary(Body0),
S = size(Body1),
S = erlang:byte_size(Body1),
CT = hackney_headers:get_value(<<"content-type">>, Headers,
<<"application/octet-stream">>),
{S, CT, iolist_to_binary(Body1)};
{S, CT, Body1};
_ when is_binary(Body0) ->
S = erlang:byte_size(Body0),
CT = hackney_headers:get_value(<<"content-type">>, Headers,
Expand Down

0 comments on commit c4b7e2c

Please sign in to comment.