Skip to content

Commit

Permalink
Fix option parsing for client
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Dec 2, 2024
1 parent 96cf073 commit 03a71aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/lexdee/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule Lexdee.Client do
timeout = Keyword.get(options, :timeout, 30_000)

if Application.get_env(:lexdee, :environment) == :test do
{Tesla.Adapter.Mint, timeout: timeout}
{Tesla.Adapter.Mint, timeout: timeout, transport_opts: []}
else
{Tesla.Adapter.Mint,
timeout: timeout,
Expand Down
6 changes: 3 additions & 3 deletions lib/lexdee/observer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule Lexdee.Observer do
resource = Keyword.get(opts, :resource)
type = to_string(Keyword.get(opts, :type, "operation"))

%{adapter: {_, _, options}, pre: middlewares} = client
%{adapter: {_, _, [options]}, pre: middlewares} = client

{_, _, [base_url]} =
Enum.find(middlewares, fn {k, _, _v} ->
Expand All @@ -75,14 +75,14 @@ defmodule Lexdee.Observer do
"wss://#{base_uri.host}:#{base_uri.port}/1.0/events?type=#{type}"

timeout = Keyword.get(options, :timeout, 30_000)

transport_opts =
options
|> Keyword.get(:transport_opts, [])
|> Keyword.fetch!(:transport_opts)
|> Keyword.put(:timeout, timeout)

options =
options
|> List.flatten()
|> Keyword.put(:protocols, [:http1])
|> Keyword.put(:transport_opts, transport_opts)

Expand Down

0 comments on commit 03a71aa

Please sign in to comment.