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:
João Paulo Dubas 2024-10-07 19:16:46 +00:00
parent df16f2ce1c
commit c77d4eb97d
Signed by: joao.dubas
SSH Key Fingerprint: SHA256:V1mixgOGRc/YMhGx/DNkOSmJxgA2vHNrDZEk3wt/kOA

View File

@ -240,7 +240,16 @@ defmodule Growth.Indicators.Download do
end
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}} ->
body