Erlang HTTP: How do you include Body in an Inets or Ibrowse request?

1.3k Views Asked by At

I am currently using Inets with the following request:

http:request(put, {Url, [{"User-Agent", UA}, {"Content-type", 
             "application/json"}]}, Bodytext, []),

But the request fails.

Any suggestions?

2

There are 2 best solutions below

0
On BEST ANSWER

ibrowse:start().

ibrowse:send_req(Url, Headers, put, Body).

OR

ibrowse:send_req(Url, Headers, put, Body, Options).

1
On

Try this: http:request(put, {Url, [{"User-Agent", UA}], "application/json", Bodytext}, [], [])