From c4b7e2c45bfd87806494f5e5ad3766d138edbe8e Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Tue, 7 Jul 2015 14:43:42 +0200 Subject: [PATCH] Only call iolist_to_binary once --- src/hackney_client/hackney_request.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hackney_client/hackney_request.erl b/src/hackney_client/hackney_request.erl index 83a10bbb..15e89072 100644 --- a/src/hackney_client/hackney_request.erl +++ b/src/hackney_client/hackney_request.erl @@ -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,