diff options
author | unknown <me@bluerain.io> | 2020-11-10 19:48:03 +0800 |
---|---|---|
committer | unknown <me@bluerain.io> | 2020-11-10 19:48:03 +0800 |
commit | 59740abc35b2bb8c33d76c9ba893095dc809eb0f (patch) | |
tree | 095ff2e24c07499cb363d5e654c57da6b2e3ccc3 | |
parent | Add some APIs (diff) |
Update configuration
-rw-r--r-- | lib/azure_ex/config.ex | 4 | ||||
-rw-r--r-- | lib/azure_ex/request.ex | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/azure_ex/config.ex b/lib/azure_ex/config.ex index 7c67ebf..672ffce 100644 --- a/lib/azure_ex/config.ex +++ b/lib/azure_ex/config.ex @@ -4,8 +4,8 @@ defmodule AzureEx.Config do @default_timeout 1000 * 15 @default_recv_timeout 1000 * 10 - @spec timeouts :: [timeout: integer(), recv_timeout: integer()] - def timeouts, + @spec http_options :: [timeout: integer(), recv_timeout: integer()] + def http_options, do: [ timeout: get(:timeout, @default_timeout), recv_timeout: get(:recv_timeout, @default_recv_timeout) diff --git a/lib/azure_ex/request.ex b/lib/azure_ex/request.ex index 7dcd957..97a4927 100644 --- a/lib/azure_ex/request.ex +++ b/lib/azure_ex/request.ex @@ -37,7 +37,7 @@ defmodule AzureEx.Request do defp send(:get, endpoint, _data) do headers = [Authorization: "Bearer #{TokenHosting.get_token()}"] - HTTPoison.get(endpoint, headers, Config.timeouts()) + HTTPoison.get(endpoint, headers, Config.http_options()) end defp send(:post, endpoint, data) do @@ -48,7 +48,7 @@ defmodule AzureEx.Request do body = Jason.encode!(data || %{}) - HTTPoison.post(endpoint, body, headers, Config.timeouts()) + HTTPoison.post(endpoint, body, headers, Config.http_options()) end defp send(:put, endpoint, data) do @@ -59,12 +59,12 @@ defmodule AzureEx.Request do body = Jason.encode!(data || %{}) - HTTPoison.put(endpoint, body, headers, Config.timeouts()) + HTTPoison.put(endpoint, body, headers, Config.http_options()) end defp send(:delete, endpoint, _data) do headers = [Authorization: "Bearer #{TokenHosting.get_token()}"] - HTTPoison.delete(endpoint, headers, Config.timeouts()) + HTTPoison.delete(endpoint, headers, Config.http_options()) end end |