summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz>2023-11-20 12:25:36 -0700
committerGitHub <noreply@github.com>2023-11-20 12:25:36 -0700
commit88266a50e5fa818578b23b92fa79f08a09759edb (patch)
tree2e4c8d0427205681bb8f201fec59cb3c7169827c
parentfcef09f1043f27c97d7b34b4330528f0700662a3 (diff)
downloadchessh-88266a50e5fa818578b23b92fa79f08a09759edb.tar.gz
chessh-88266a50e5fa818578b23b92fa79f08a09759edb.zip
grab authorization header rather than post message
-rw-r--r--lib/chessh/web/web.ex5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/chessh/web/web.ex b/lib/chessh/web/web.ex
index af70ebb..26385df 100644
--- a/lib/chessh/web/web.ex
+++ b/lib/chessh/web/web.ex
@@ -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))