sending a json body with http:request
Thu Jan 28 23:55:25 CET 2010
> mochijson2:encode/1 returns binary so do I need to use binary_to_list on it?
I think mochijson2:encode/1 returns an iolist, not a binary. You can
use the iolist_to_binary function to convert to binary.
> Do I need to url encode the Params?
If you're sending content as "application/x-www-form-urlencoded", then
it should be encoded appropriately:
Note that this is different to the URI encoding defined in RFC 3986.
> Is there a url encoding function in erlang other then edoc_lib:escape_uri/1?
AFAIK, no. That doesn't appear to encode as application/x-www-form-
I put together a comparison of several different encoding
Is there a reason the server expects a mixture of JSON *and* form
urlencoded params? Surely it would be easier to just send a JSON
More information about the erlang-questions