Apply lambadalambda's suggestion(s) to 1 file(s)
This commit is contained in:
parent
43a124bb14
commit
374e8c85a7
1 changed files with 2 additions and 9 deletions
|
|
@ -42,15 +42,8 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Default to JSON when no format is specified or format is not recognized
|
# Default to JSON when no format is specified or format is not recognized
|
||||||
def webfinger(%{assigns: %{format: _format}} = conn, %{"resource" => resource}) do
|
def webfinger(%{assigns: %{format: _format}} = conn, %{"resource" => _resource} = params) do
|
||||||
with {:ok, response} <- WebFinger.webfinger(resource, "JSON") do
|
webfinger(put_in(conn.assigns.format, "json"), params)
|
||||||
json(conn, response)
|
|
||||||
else
|
|
||||||
_e ->
|
|
||||||
conn
|
|
||||||
|> put_status(404)
|
|
||||||
|> json("Couldn't find user")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def webfinger(conn, _params), do: send_resp(conn, 400, "Bad Request")
|
def webfinger(conn, _params), do: send_resp(conn, 400, "Bad Request")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue