chore(growth): allow one to customize Req
options
With this change it's possible to change the way the application make requests to WHO website.
This commit is contained in:
parent
df16f2ce1c
commit
c77d4eb97d
@ -240,7 +240,16 @@ defmodule Growth.Indicators.Download do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fetch!(url) do
|
def fetch!(url) do
|
||||||
case Req.get(url) do
|
req =
|
||||||
|
[url: url]
|
||||||
|
|> Keyword.merge(
|
||||||
|
:wabanex
|
||||||
|
|> Application.get_env(__MODULE__, [])
|
||||||
|
|> Keyword.get(:who_req_options, [])
|
||||||
|
)
|
||||||
|
|> Req.new()
|
||||||
|
|
||||||
|
case Req.get(req) do
|
||||||
{:ok, %{status: 200, body: body}} ->
|
{:ok, %{status: 200, body: body}} ->
|
||||||
body
|
body
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user