grab authorization header rather than post message

This commit is contained in:
Elizabeth Hunt 2023-11-20 12:25:36 -07:00 committed by GitHub
parent fcef09f104
commit 88266a50e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -291,7 +291,10 @@ defmodule Chessh.Web.Endpoint do
end
post "/bots/games/:id/turn" do
token = conn.body_params["token"]
token =
Enum.find_value(conn.req_headers, fn {header, value} ->
if header === "authorization", do: value
end)
attempted_move = conn.body_params["attempted_move"]
bot = Repo.one(from(b in Bot, where: b.token == ^token))