Websocket handler: fix never matching code on failed auth

`:cowboy_req.reply` does not return tuples since 2.0, see
https://ninenines.eu/docs/en/cowboy/2.4/manual/cowboy_req.reply/
This commit is contained in:
rinpatch 2020-09-10 21:26:52 +03:00
parent e16e8f9816
commit 01fa68fe45

View file

@ -37,12 +37,12 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
else else
{:error, :bad_topic} -> {:error, :bad_topic} ->
Logger.debug("#{__MODULE__} bad topic #{inspect(req)}") Logger.debug("#{__MODULE__} bad topic #{inspect(req)}")
{:ok, req} = :cowboy_req.reply(404, req) req = :cowboy_req.reply(404, req)
{:ok, req, state} {:ok, req, state}
{:error, :unauthorized} -> {:error, :unauthorized} ->
Logger.debug("#{__MODULE__} authentication error: #{inspect(req)}") Logger.debug("#{__MODULE__} authentication error: #{inspect(req)}")
{:ok, req} = :cowboy_req.reply(401, req) req = :cowboy_req.reply(401, req)
{:ok, req, state} {:ok, req, state}
end end
end end