Hello,
I have a module which needs to use HTTPoison before compile time to configure a module attribute, something like this:
HTTPoison.start()
response = HTTPoison.get! url
{:ok, response} = Poison.decode(response.body)
@attr response
I would like to remove the HTTPoison.start() and tried to configure it in extra_applications like this:
extra_applications: [:httpoison],
Doc says:
• :extra_applications - a list of Erlang/Elixir applications that you
want started before your application. For example, Elixir’s :logger or
Erlang’s :crypto. Mix guarantees that any application given here and all of
your runtime dependencies are started before your application starts.
So it looks like its what I need, but it doesnt work
== Compilation error in file lib/module.ex ==
** (ArgumentError) argument error
(stdlib) :ets.lookup_element(:hackney_config, :mod_metrics, 2)
/project/deps/hackney/src/hackney_metrics.erl:27: :hackney_metrics.get_engine/0
/project/deps/hackney/src/hackney_connect.erl:69: :hackney_connect.create_connection/5
/project/deps/hackney/src/hackney_connect.erl:37: :hackney_connect.connect/5
/project/deps/hackney/src/hackney.erl:316: :hackney.request/5
lib/httpoison/base.ex:630: HTTPoison.Base.request/9
lib/httpoison.ex:66: HTTPoison.request!/5
lib/module.ex:4: (module)
what am I missing? cant be done like that? also tried with applications and included_applications with no luck