Skip to content

Instantly share code, notes, and snippets.

@thluiz
Last active August 29, 2015 14:14
Show Gist options
  • Save thluiz/78da6d2207b4a3f1c4c6 to your computer and use it in GitHub Desktop.
Save thluiz/78da6d2207b4a3f1c4c6 to your computer and use it in GitHub Desktop.
Making a HTTPoison post request in Elixir
case HTTPoison.post(url, body, headers) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
body
{:ok, %HTTPoison.Response{status_code: 404}} ->
"Not found :("
{:error, %HTTPoison.Error{reason: reason}} ->
reason
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment