summaryrefslogtreecommitdiff
path: root/lib/powerdnsex/http_client.ex
blob: 343179568c86638a54ff0f662e8f6dcd58634568 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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