Follow webfinger redirects.

This commit is contained in:
Roger Braun 2017-05-02 17:44:55 +02:00
parent 96014f8e0b
commit b104348fa5

View file

@ -92,7 +92,7 @@ def finger(account, getter \\ &HTTPoison.get/3) do
response = with {:ok, result} <- getter.("https:" <> address, ["Accept": "application/xrd+xml"], [params: [resource: account]]) do
{:ok, result}
else _ ->
getter.("http:" <> address, ["Accept": "application/xrd+xml"], [params: [resource: account]])
getter.("http:" <> address, ["Accept": "application/xrd+xml"], [params: [resource: account], follow_redirect: true])
end
with {:ok, %{status_code: status_code, body: body}} when status_code in 200..299 <- response,