Skip to content

Commit 14effe5

Browse files
committed
make httpoison an optional dependency
1 parent 9af5fbb commit 14effe5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/safeurl.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ defmodule SafeURL do
213213
@spec get(binary(), Keyword.t(), HTTPoison.headers(), Keyword.t()) ::
214214
{:ok, HTTPoison.Response.t()} | {:error, :restricted}
215215
def get(url, options \\ [], headers \\ [], httpoison_options \\ []) do
216+
unless function_exported?(HTTPoison, :get, 3) do
217+
raise "HTTPoison.get/3 not available"
218+
end
216219
with :ok <- validate(url, options) do
217220
HTTPoison.get(url, headers, httpoison_options)
218221
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ defmodule SafeURL.MixProject do
5757
# Dependencies
5858
defp deps do
5959
[
60-
{:httpoison, "~> 1.8"},
60+
{:httpoison, "~> 1.8", optional: true},
6161
{:inet_cidr, "~> 1.0"},
6262
{:dns, "~> 2.2"},
6363
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},

0 commit comments

Comments
 (0)