From 03a71aa11c4c018d3b057823fd5cdb6ba55632e2 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Mon, 2 Dec 2024 18:05:01 +0700 Subject: [PATCH] Fix option parsing for client --- lib/lexdee/client.ex | 2 +- lib/lexdee/observer.ex | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/lexdee/client.ex b/lib/lexdee/client.ex index ff1649f..02d38e8 100644 --- a/lib/lexdee/client.ex +++ b/lib/lexdee/client.ex @@ -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, diff --git a/lib/lexdee/observer.ex b/lib/lexdee/observer.ex index 1965426..cf0075a 100644 --- a/lib/lexdee/observer.ex +++ b/lib/lexdee/observer.ex @@ -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} -> @@ -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)