Skip to content

Commit 15026b4

Browse files
committed
use :json_codec instead of Poison
1 parent 0f65594 commit 15026b4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/aws_ex_ray/ex_aws/http_client.ex

+9-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ defmodule AwsExRay.ExAws.HTTPClient do
3434

3535
whitelist = WhiteList.find(service, operation)
3636

37-
aws_req_params = gather_aws_request_params(whitelist, body)
37+
json_codec = ExAws.Config.new(:xray)[:json_codec]
38+
aws_req_params = gather_aws_request_params(whitelist, body, json_codec)
3839

3940
headers = HTTPClientUtil.put_tracing_header(headers, subsegment)
4041

@@ -49,7 +50,7 @@ defmodule AwsExRay.ExAws.HTTPClient do
4950

5051
subsegment = Subsegment.set_http_response(subsegment, res)
5152

52-
aws_res_params = gather_aws_response_params(whitelist, body)
53+
aws_res_params = gather_aws_response_params(whitelist, body, json_codec)
5354

5455
request_id = Util.get_header(headers, "x-amzn-RequestId")
5556

@@ -99,19 +100,19 @@ defmodule AwsExRay.ExAws.HTTPClient do
99100
Keyword.put_new(opts, :recv_timeout, @default_recv_timeout)
100101
end
101102

102-
defp gather_aws_response_params(_whitelist, ""), do: %{}
103-
defp gather_aws_response_params(whitelist, body) do
104-
case Poison.decode(body) do
103+
defp gather_aws_response_params(_whitelist, "", _json_codec), do: %{}
104+
defp gather_aws_response_params(whitelist, body, json_codec) do
105+
case json_codec.decode(body) do
105106
{:ok, json} ->
106107
WhiteList.gather(:response, json, whitelist)
107108

108109
_ -> %{}
109110
end
110111
end
111112

112-
defp gather_aws_request_params(_whitelist, ""), do: %{}
113-
defp gather_aws_request_params(whitelist, body) do
114-
case Poison.decode(body) do
113+
defp gather_aws_request_params(_whitelist, "", _json_codec), do: %{}
114+
defp gather_aws_request_params(whitelist, body, json_codec) do
115+
case json_codec.decode(body) do
115116

116117
{:ok, json} ->
117118
WhiteList.gather(:request, json, whitelist)

0 commit comments

Comments
 (0)