Packages
tzdata
1.1.3
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc.1
1.0.0-rc.0
0.5.22
0.5.21
0.5.20
0.5.19
0.5.18
0.5.17
0.5.16
0.5.15
0.5.14
0.5.13
0.5.12
0.5.11
0.5.10
0.5.9
0.5.8
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.1.201805
0.1.201605
0.1.201603
0.1.201601
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.2
0.0.1
Tzdata is a parser and library for the tz database.
Current section
Files
Jump to
Current section
Files
lib/tzdata/http_client/hackney.ex
defmodule Tzdata.HTTPClient.Hackney do
@moduledoc false
@behaviour Tzdata.HTTPClient
if Code.ensure_loaded?(:hackney) do
@impl true
def get(url, headers, options) do
with {:ok, status, headers, client_ref} <- :hackney.get(url, headers, "", options),
{:ok, body} <- :hackney.body(client_ref) do
{:ok, {status, headers, body}}
end
end
@impl true
def head(url, headers, options) do
with {:ok, status, headers} <- :hackney.head(url, headers, "", options) do
{:ok, {status, headers}}
end
end
else
@message """
missing :hackney dependency
Tzdata requires a HTTP client in order to automatically update timezone
database.
In order to use the built-in adapter based on Hackney HTTP client, add the
following to your mix.exs dependencies list:
{:hackney, "~> 1.0"}
See README for more information.
"""
@impl true
def get(_url, _headers, _options) do
raise @message
end
@impl true
def head(_url, _headers, _options) do
raise @message
end
end
end