defmodule SplitClient.Boundary.HTTP do # Adapter around an HTTP dependency that makes it our own @moduledoc false @behaviour SplitClient.Boundary.HTTPBehaviour def get(url, headers, options \\ []) do options = Keyword.merge(httpoison_config(), options) |> disable_proxy_env_vars() HTTPoison.get(url, headers, options) end # hackney doesn't look at the NO_PROXY/no_proxy env var. HTTPoison does, but # it responds by sending an empty list for the proxy option which results in # no proxy option. If you have HTTP_PROXY set for other endpoints hackney will # add that in as a proxy value making HTTPoison's filtering of it irrelevant. # # We'll handle this by ignoring all proxy env vars in hackney and let httpoison # handle those defp disable_proxy_env_vars(options) do Keyword.put(options, :hackney, [no_proxy_env: true]) end defp httpoison_config do Application.get_env(:split_client, :httpoison, []) end end