summaryrefslogtreecommitdiff
path: root/lib/powerdnsex/http_client.ex
blob: 98e299d08220f9e41622e47558fb65895fd37bdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
defmodule PowerDNSex.HttpClient do
  @moduledoc """
  Client to do http requests for PowerDns API
  """

  use HTTPoison.Base

  alias PowerDNSex.Config

  def process_url(url), do: Config.powerdns_url() <> url

  def process_request_headers(headers) do
    custom = ["X-API-Key": Config.powerdns_token()]
    Keyword.merge(headers, custom)
  end

  def process_request_options(options) do
    custom_options = [ssl: [{:versions, [:"tlsv1.1"]}], recv_timeout: Config.powerdns_timeout()]
    Keyword.merge(options, custom_options)
  end
end