dkataskin / erlazure

Windows Azure Erlang bindings
BSD 3-Clause "New" or "Revised" License
35 stars 54 forks source link

Calculate the content-length correctly #34

Closed jgmchan closed 2 years ago

jgmchan commented 2 years ago

lists:flatlength/1 does not return the correct size if the iolist has binaries. Use erlang:iolist_size/1 instead. e.g.

lists:flatlength([<<"a">>, [<<"bc">>]]).
2

erlang:iolist_size([<<"a">>, [<<"bc">>]]).
3

This wasn't an issue before as Azure ignored the content-length and things just worked but recently it looks like they will throw errors if the content-length does not match the size of the payload.

dkataskin commented 2 years ago

Thank you!