Answers for "elixir get request"

0

http get elixir

# set HTTPoison, Jason
def deps do
  [
    {:httpoison, "~> 1.6"},
    {:jason, "~> 1.0"},
  ]
end

# use HTTPoison
HTTPoison.get!("https://api.github.com")
%HTTPoison.Response{status_code: 200,
                    headers: [{"content-type", "application/json"}],
                    body: "{...}"}
# use Jason                    
Jason.encode!(%{"age" => 44})
"{"age":44}"

Jason.decode!(~s({"age":44}))
%{"age" => 44}
Posted by: Guest on July-31-2020

Browse Popular Code Answers by Language