Last active
August 29, 2015 14:14
-
-
Save thluiz/78da6d2207b4a3f1c4c6 to your computer and use it in GitHub Desktop.
Making a HTTPoison post request in Elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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