Skip to content

Commit

Permalink
Replace poison with jason
Browse files Browse the repository at this point in the history
  • Loading branch information
edennis committed Apr 29, 2019
1 parent daf3c3f commit 9258e06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/krakex/http_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ defmodule Krakex.HTTPClient do

defp handle_http_response(%{status_code: status_code, body: body})
when status_code in 200..206 do
case Poison.decode(body) do
{:ok, decoded} -> {:ok, decoded}
{:error, :invalid, _} -> {:error, {:invalid, body}}
{:error, {:invalid, _, _}} -> {:error, {:invalid, body}}
case Jason.decode(body) do
{:ok, decoded} ->
{:ok, decoded}

{:error, %Jason.DecodeError{}} ->
{:error, {:invalid, body}}
end
end

Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ defmodule Krakex.Mixfile do

defp deps do
[
{:httpoison, "~> 0.13"},
{:poison, "~> 3.1"},
{:httpoison, "~> 1.1.0"},
{:jason, "~> 1.1"},
{:excoveralls, "~> 0.8", only: :test},
{:mix_test_watch, "~> 0.5", only: :dev, runtime: false},
{:dialyxir, "~> 0.5.0", only: [:dev, :test], runtime: false},
Expand Down

0 comments on commit 9258e06

Please sign in to comment.