aboutsummaryrefslogtreecommitdiff
path: root/lib/zendex/common_helpers.ex
blob: dceb56d1cf5294e3b9fa646064614cfeca5708dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
defmodule Zendex.CommonHelpers do
  @moduledoc """
  Contains common helper functions used throughout Zendex.
  """

  def decode_response(%{body: body}), do: Poison.decode!(body)

  def get_headers(authentication) do
    [{"Authorization", "Basic #{authentication}"}]
  end

  def get_headers(authentication, %{content_type: :json}) do
    get_headers(authentication) ++ [{"Content-Type", "application/json"}]
  end
end