I'm trying to transform CURL request with HTTPoison in Elixir Phoenix. When I run CURL request commend, It work fine.I got "415 Unsupported media type" error when I try with HTTPoison.
Phoenix/Elixir - cURL works, but HTTPoison fails
Here is my CURL request
curl -u "user:password" -i -H "Accept:application/json" -X POST -d
"amount=100&method=0&type=bank&receiver=CCC&info1=hello"
http://00.000.000.00:8080/services/id/999999111999/calculate
Here is my Httpoison request
url = "myurl"
orderid = "myorderid"
headers = ["Accept", "application/json"]
request_body = '{"type" : "bank",
"method" : 0,
"amount" : #{amount},
"receiver" : "CCC"
"info1" : #{orderid}}'
dicoba = HTTPoison.post(url, headers, request_body, hackney: [basic_auth: {"#{user}", "#password"}]) |> IO.inspect