|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy(proxy)
end
- defp add_scheme_opts(opts, %URI{scheme: "http"}), do: opts
-
- defp add_scheme_opts(opts, %URI{scheme: "https", host: host}) do
- ssl_opts = [
- ssl_options: [
- # Workaround for remote server certificate chain issues
- partial_chain: &:hackney_connect.partial_chain/1,
-
- # We don't support TLS v1.3 yet
- versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
- server_name_indication: to_charlist(host)
- ]
- ]
-
- Keyword.merge(opts, ssl_opts)
- end
+ defp add_scheme_opts(opts, _), do: opts
def after_request(_), do: :ok
end
assert opts[:b] == 1
refute Keyword.has_key?(opts, :proxy)
end
-
- test "add opts for https" do
- uri = URI.parse("https://domain.com")
-
- opts = Hackney.options(uri)
-
- assert opts[:ssl_options] == [
- partial_chain: &:hackney_connect.partial_chain/1,
- versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
- server_name_indication: 'domain.com'
- ]
- end
end
end