Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use byte_size/1 instead of length/1 on binary #22

Merged
merged 1 commit into from

2 participants

@keynslug

By all means it seems that hackney_util:join/2 return binary value so
length/1 is not applicable, byte_size/1 is.

@keynslug keynslug Use byte_size/1 instead of length/1 on binary
By all means it seems that hackney_util:join return binary value so
length/1 is not applicable, byte_size/1 is.
61c7238
@benoitc benoitc merged commit 88a7d65 into benoitc:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 27, 2013
  1. @keynslug

    Use byte_size/1 instead of length/1 on binary

    keynslug authored
    By all means it seems that hackney_util:join return binary value so
    length/1 is not applicable, byte_size/1 is.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/hackney_form.erl
View
2  src/hackney_form.erl
@@ -22,7 +22,7 @@ encode_form(KVs) ->
encode_form([], Acc) ->
Lines = hackney_util:join(lists:reverse(Acc), <<"&">>),
CType = <<"application/x-www-form-urlencoded; charset=utf-8">>,
- {erlang:length(Lines), CType, Lines};
+ {erlang:byte_size(Lines), CType, Lines};
encode_form([{K,V}|R], Acc) ->
K1 = hackney_url:urlencode(K),
V1 = hackney_url:urlencode(V),
Something went wrong with that request. Please try again.