HTTPoison is an HTTP client for Elixir. We have already used it in the Managing dependencies recipe of Chapter 1, Command Line.
In this recipe, we will create a simple application that will take a URL and fetch the corresponding page, returning either the body or the headers of that request.
We will be using the
get_pages application. You will find it in the source code of this book. The steps are as follows:
> cd get_pages
> mix deps.get && mix deps.compile
> iex –S mix
To get an HTTP response and perform pattern matching on it, we will follow these steps: