diff --git a/lib/http_client_builder.ex b/lib/http_client_builder.ex index a025788..871fba0 100755 --- a/lib/http_client_builder.ex +++ b/lib/http_client_builder.ex @@ -96,8 +96,9 @@ defmodule HttpClientBuilder do headers = if unquote(client_opts)[:runtime_headers_getter] do - (unquote(client_opts)[:runtime_headers_getter].() ++ compile_time_headers) - |> dedup_headers() + compile_time_headers + |> Kernel.++(unquote(client_opts)[:runtime_headers_getter].()) + |> Enum.uniq_by(&elem(&1, 0)) else compile_time_headers end @@ -115,12 +116,6 @@ defmodule HttpClientBuilder do base_url <> url_or_path <> query end - defp dedup_headers(headers) do - headers - |> Enum.reduce(%{}, fn {k, v}, acc -> Map.put(acc, k, v) end) - |> Map.to_list() - end - defoverridable get: 2, post: 2, put: 2, delete: 2, patch: 2, do_request: 3, build_url: 2 end end