Fix credo issues

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-06-14 18:15:27 +02:00
parent ca36dd12e2
commit a007764d27
17 changed files with 267 additions and 44 deletions

View File

@@ -1,4 +1,9 @@
defmodule Eventos.Service.WebFinger do
@moduledoc """
# WebFinger
Performs the WebFinger requests and responses (json only)
"""
alias Eventos.Actors
alias Eventos.Service.XmlBuilder
@@ -59,7 +64,9 @@ defmodule Eventos.Service.WebFinger do
{"application/activity+json", "self"} ->
Map.put(data, "url", link["href"])
_ ->
Logger.debug("Unhandled type: #{inspect(link["type"])}")
Logger.debug fn ->
"Unhandled type: #{inspect(link["type"])}"
end
data
end
end)
@@ -81,7 +88,7 @@ defmodule Eventos.Service.WebFinger do
address = "http://#{domain}/.well-known/webfinger?resource=acct:#{actor}"
Logger.debug(inspect address)
with {:ok, %HTTPoison.Response{} = response} <- HTTPoison.get(address, [Accept: "application/json, application/activity+json, application/jrd+json"],follow_redirect: true),
with {:ok, %HTTPoison.Response{} = response} <- HTTPoison.get(address, [Accept: "application/json, application/activity+json, application/jrd+json"], follow_redirect: true),
%{status_code: status_code, body: body} when status_code in 200..299 <- response do
{:ok, doc} = Jason.decode(body)
webfinger_from_json(doc)