I want to create a Github token in Elixir using the HTTPoison library, but I just can't figure out how to send the HTTPoison parameter.
When using curl it will be something like this
$ curl -i -u "ColdFreak" -H "X-GitHub-OTP: 123456" -d '{"scopes": ["repo", "user"], "note" : "getting-started"}' https://api.github.com/authorizations
when I use the HTTPoison library, I just can't figure out how to publish it.
url = "https://api.github.com/authorizations" HTTPoison.post!(url, [scopes: ["repo", "user"], note: "getting-started"], %{"X-GitHub-OTP" => "12345"})
then he gave an error something like this
** (ArgumentError) argument error :erlang.iolist_to_binary([{"scopes", ["repo", "user"]}, {"note", "getting-started"}]) (hackney) src/hackney_client/hackney_request.erl:338: :hackney_request.handle_body/4 (hackney) src/hackney_client/hackney_request.erl:79: :hackney_request.perform/2
Can someone tell me how to do it right.
HTTPoison documentation here
elixir
ηεΏθ»
source share