Merge remote-tracking branch 'origin/debug-suggestions-api' into correct-and-improve-http-options

This commit is contained in:
Hakaba Hitoyo 2018-12-06 10:48:05 +09:00
commit 505d820827
1 changed files with 9 additions and 1 deletions

View File

@ -1182,7 +1182,15 @@ def suggestions(%{assigns: %{user: user}} = conn, _) do
url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user)
with {:ok, %{status: 200, body: body}} <-
@httpoison.get(url, [], timeout: timeout, recv_timeout: timeout),
@httpoison.get(
url,
[],
follow_redirect: true,
adapter: [
timeout: timeout,
recv_timeout: timeout
]
),
{:ok, data} <- Jason.decode(body) do
data2 =
Enum.slice(data, 0, limit)