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 @@ def init(%{qs: qs} = req, state) do
else
{:error, :bad_topic} ->
Logger.debug("#{__MODULE__} bad topic #{inspect(req)}")
{:ok, req} = :cowboy_req.reply(404, req)
req = :cowboy_req.reply(404, req)
{:ok, req, state}
{:error, :unauthorized} ->
Logger.debug("#{__MODULE__} authentication error: #{inspect(req)}")
{:ok, req} = :cowboy_req.reply(401, req)
req = :cowboy_req.reply(401, req)
{:ok, req, state}
end
end