15 lines
291 B
Elixir
15 lines
291 B
Elixir
defmodule ElixirRss.Fetch do
|
|
def fetch(url) do
|
|
url
|
|
|> HTTPoison.get()
|
|
|> handle_response()
|
|
end
|
|
|
|
defp handle_response({:ok, %{status_code: 200, body: body}}) do
|
|
{:ok, body}
|
|
end
|
|
defp handle_response({_, %{status_code: _, body: body}}) do
|
|
{:error, body}
|
|
end
|
|
end
|