Skip to content

Instantly share code, notes, and snippets.

@Yoosuke
Created February 27, 2019 02:56
Show Gist options
  • Save Yoosuke/74b1c101b3c8c70e7747b0bbe4d659d6 to your computer and use it in GitHub Desktop.
Save Yoosuke/74b1c101b3c8c70e7747b0bbe4d659d6 to your computer and use it in GitHub Desktop.
defmodule Aedmap.ExJson do
def get(base_url, resource_path) do
case (base_url <> resource_path) |> HTTPoison.get! do
%HTTPoison.Response{body: body, status_code: 200} -> body |> Poison.decode!
%HTTPoison.Error{reason: reason} -> raise "Oops, #{reason}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment