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
1 changed files with 2 additions and 2 deletions

View File

@ -37,12 +37,12 @@ def init(%{qs: qs} = req, state) 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