summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2020-07-26 23:07:49 -0400
committerHubert Chathi <hubert@uhoreg.ca>2020-07-26 23:07:49 -0400
commit7b347e840e08857b9ab3e00902984085e9a517bc (patch)
tree08b1cda583a661da67787bfb68d88baffa3a1f9c
parentedit changelog and bump version (diff)
use Jason instead of Poison
-rw-r--r--lib/polyjuice/client/endpoint.ex2
-rw-r--r--lib/polyjuice/client/endpoint/get_rooms_messages.ex2
-rw-r--r--lib/polyjuice/client/endpoint/get_sync.ex2
-rw-r--r--lib/polyjuice/client/endpoint/post_join.ex2
-rw-r--r--lib/polyjuice/client/endpoint/post_login.ex2
-rw-r--r--lib/polyjuice/client/endpoint/post_user_filter.ex2
-rw-r--r--lib/polyjuice/client/endpoint/put_rooms_send.ex2
-rw-r--r--lib/polyjuice/client/endpoint/put_rooms_state.ex2
-rw-r--r--lib/polyjuice/client/sync.ex6
-rw-r--r--mix.exs2
-rw-r--r--mix.lock2
-rw-r--r--test/polyjuice/client/endpoint/post_join_test.exs2
-rw-r--r--test/polyjuice/client/endpoint/post_login_test.exs2
13 files changed, 15 insertions, 15 deletions
diff --git a/lib/polyjuice/client/endpoint.ex b/lib/polyjuice/client/endpoint.ex
index a328ea9..b75ee6c 100644
--- a/lib/polyjuice/client/endpoint.ex
+++ b/lib/polyjuice/client/endpoint.ex
@@ -88,7 +88,7 @@ defmodule Polyjuice.Client.Endpoint do
def parse_response(%{} = endpoint_args, status_code, headers, body)
when is_integer(status_code) and is_list(headers) and is_binary(body) do
# FIXME: check if content type is "application/json"
- with {:ok, json} <- Poison.decode(body) do
+ with {:ok, json} <- Jason.decode(body) do
case status_code do
200 ->
Polyjuice.Client.Endpoint.BodyParser.parse(endpoint_args, json)
diff --git a/lib/polyjuice/client/endpoint/get_rooms_messages.ex b/lib/polyjuice/client/endpoint/get_rooms_messages.ex
index 3a5d2df..542fa62 100644
--- a/lib/polyjuice/client/endpoint/get_rooms_messages.ex
+++ b/lib/polyjuice/client/endpoint/get_rooms_messages.ex
@@ -56,7 +56,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsMessages do
],
if(req.to, do: [{"to", req.to}], else: []),
if(req.limit, do: [{"limit", req.limit}], else: []),
- if(req.filter, do: [{"filter", Poison.encode!(req.filter)}], else: [])
+ if(req.filter, do: [{"filter", Jason.encode!(req.filter)}], else: [])
]
|> Enum.concat()
|> URI.encode_query()
diff --git a/lib/polyjuice/client/endpoint/get_sync.ex b/lib/polyjuice/client/endpoint/get_sync.ex
index 511fb21..42477a6 100644
--- a/lib/polyjuice/client/endpoint/get_sync.ex
+++ b/lib/polyjuice/client/endpoint/get_sync.ex
@@ -54,7 +54,7 @@ defmodule Polyjuice.Client.Endpoint.GetSync do
if(since, do: [{"since", since}], else: []),
if(full_state, do: [{"full_state", "true"}], else: []),
case filter do
- %{} -> [{"filter", Poison.encode!(filter)}]
+ %{} -> [{"filter", Jason.encode!(filter)}]
nil -> []
_ -> [{"filter", filter}]
end,
diff --git a/lib/polyjuice/client/endpoint/post_join.ex b/lib/polyjuice/client/endpoint/post_join.ex
index 6689f59..00d3669 100644
--- a/lib/polyjuice/client/endpoint/post_join.ex
+++ b/lib/polyjuice/client/endpoint/post_join.ex
@@ -44,7 +44,7 @@ defmodule Polyjuice.Client.Endpoint.PostJoin do
e = &URI.encode_www_form/1
body =
- Poison.encode!(
+ Jason.encode!(
if third_party_signed do
%{"third_party_signed" => third_party_signed}
else
diff --git a/lib/polyjuice/client/endpoint/post_login.ex b/lib/polyjuice/client/endpoint/post_login.ex
index 23fa5c3..ce093f0 100644
--- a/lib/polyjuice/client/endpoint/post_login.ex
+++ b/lib/polyjuice/client/endpoint/post_login.ex
@@ -65,7 +65,7 @@ defmodule Polyjuice.Client.Endpoint.PostLogin do
]
|> Enum.concat()
|> Map.new()
- |> Poison.encode!()
+ |> Jason.encode!()
%Polyjuice.Client.Endpoint.HttpSpec{
method: :post,
diff --git a/lib/polyjuice/client/endpoint/post_user_filter.ex b/lib/polyjuice/client/endpoint/post_user_filter.ex
index cf57437..ceab001 100644
--- a/lib/polyjuice/client/endpoint/post_user_filter.ex
+++ b/lib/polyjuice/client/endpoint/post_user_filter.ex
@@ -39,7 +39,7 @@ defmodule Polyjuice.Client.Endpoint.PostUserFilter do
base_url
) do
e = &URI.encode_www_form/1
- body = Poison.encode!(filter)
+ body = Jason.encode!(filter)
%Polyjuice.Client.Endpoint.HttpSpec{
method: :post,
diff --git a/lib/polyjuice/client/endpoint/put_rooms_send.ex b/lib/polyjuice/client/endpoint/put_rooms_send.ex
index 549bc2b..855f346 100644
--- a/lib/polyjuice/client/endpoint/put_rooms_send.ex
+++ b/lib/polyjuice/client/endpoint/put_rooms_send.ex
@@ -45,7 +45,7 @@ defmodule Polyjuice.Client.Endpoint.PutRoomsSend do
base_url
) do
e = &URI.encode_www_form/1
- body = Poison.encode!(message)
+ body = Jason.encode!(message)
%Polyjuice.Client.Endpoint.HttpSpec{
method: :put,
diff --git a/lib/polyjuice/client/endpoint/put_rooms_state.ex b/lib/polyjuice/client/endpoint/put_rooms_state.ex
index 51e9d64..74407bf 100644
--- a/lib/polyjuice/client/endpoint/put_rooms_state.ex
+++ b/lib/polyjuice/client/endpoint/put_rooms_state.ex
@@ -45,7 +45,7 @@ defmodule Polyjuice.Client.Endpoint.PutRoomsState do
base_url
) do
e = &URI.encode_www_form/1
- body = Poison.encode!(content)
+ body = Jason.encode!(content)
%Polyjuice.Client.Endpoint.HttpSpec{
method: :put,
diff --git a/lib/polyjuice/client/sync.ex b/lib/polyjuice/client/sync.ex
index 3f82b7d..67b83fd 100644
--- a/lib/polyjuice/client/sync.ex
+++ b/lib/polyjuice/client/sync.ex
@@ -159,14 +159,14 @@ defmodule Polyjuice.Client.Sync do
case :hackney.send_request(
state.conn_ref,
- {:post, path, headers, Poison.encode!(state.set_filter)}
+ {:post, path, headers, Jason.encode!(state.set_filter)}
) do
{:ok, status_code, _resp_headers, client_ref} ->
case status_code do
200 ->
{:ok, body} = :hackney.body(client_ref)
- with {:ok, %{} = json_body} <- Poison.decode(body),
+ with {:ok, %{} = json_body} <- Jason.decode(body),
filter_id = Map.get(json_body, "filter_id") do
Logger.debug("got filter id #{filter_id}")
@@ -233,7 +233,7 @@ defmodule Polyjuice.Client.Sync do
200 ->
{:ok, body} = :hackney.body(client_ref)
- with {:ok, json_body} <- Poison.decode(body),
+ with {:ok, json_body} <- Jason.decode(body),
%{"next_batch" => next_batch} <- json_body do
if state.backoff, do: Logger.info("Sync resumed")
process_body(json_body, state)
diff --git a/mix.exs b/mix.exs
index f6efbc5..7f0a4e2 100644
--- a/mix.exs
+++ b/mix.exs
@@ -50,7 +50,7 @@ defmodule PolyjuiceClient.MixProject do
[
{:ex_doc, "~> 0.21", only: :dev, runtime: false},
{:hackney, "~> 1.12"},
- {:poison, "~> 4.0"},
+ {:jason, "~> 1.2"},
{:polyjuice_util, "~> 0.1.0"}
]
end
diff --git a/mix.lock b/mix.lock
index 10a45d7..97bf556 100644
--- a/mix.lock
+++ b/mix.lock
@@ -4,13 +4,13 @@
"ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"hackney": {:hex, :hackney, "1.15.1", "9f8f471c844b8ce395f7b6d8398139e26ddca9ebc171a8b91342ee15a19963f4", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
+ "jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"},
- "poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm"},
"polyjuice_util": {:hex, :polyjuice_util, "0.1.0", "69901959c143245b47829c8302d0605dff6c0e1c3b116730c162982e0f512ee0", [:mix], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.4", "f0eafff810d2041e93f915ef59899c923f4568f4585904d010387ed74988e77b", [:make, :mix, :rebar3], [], "hexpm"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"},
diff --git a/test/polyjuice/client/endpoint/post_join_test.exs b/test/polyjuice/client/endpoint/post_join_test.exs
index 5d6ed65..ec9b6a4 100644
--- a/test/polyjuice/client/endpoint/post_join_test.exs
+++ b/test/polyjuice/client/endpoint/post_join_test.exs
@@ -42,7 +42,7 @@ defmodule Polyjuice.Client.Endpoint.PostJoinTest do
url: "https://example.com/_matrix/client/r0/join/%21room"
}
- assert Poison.decode!(http_spec.body) == %{
+ assert Jason.decode!(http_spec.body) == %{
"third_party_signed" => %{
"sender" => "@alice:example.org",
"mxid" => "@bob:example.org",
diff --git a/test/polyjuice/client/endpoint/post_login_test.exs b/test/polyjuice/client/endpoint/post_login_test.exs
index 0255562..85fc1ba 100644
--- a/test/polyjuice/client/endpoint/post_login_test.exs
+++ b/test/polyjuice/client/endpoint/post_login_test.exs
@@ -38,7 +38,7 @@ defmodule Polyjuice.Client.Endpoint.PostLoginTest do
url: "https://example.com/_matrix/client/r0/login"
}
- assert Poison.decode!(http_spec.body) == %{
+ assert Jason.decode!(http_spec.body) == %{
"type" => "m.login.password",
"identifier" => %{
"type" => "m.id.user",