Skip to content

Commit

Permalink
Handle multiple game cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasnaphas committed Mar 26, 2022
1 parent b5097f2 commit a87f4d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ exports.handler = async function (event, context, callback) {
logger.log("no cookies");
return { statusCode: 400, body: "Bad request" };
}
const gameCookie = event.multiValueHeaders.Cookie.find((cookie) =>

const gameCookie = event.headers.Cookie.split(";").find((cookie) =>
new RegExp(`^${gameNameHash}=.`).test(cookie)
);
const RIGHT_HAND_SIDE = 1;
Expand Down Expand Up @@ -88,7 +89,7 @@ exports.handler = async function (event, context, callback) {
};
} catch (e) {
logger.log("error on put");
logger.log(e)
logger.log(e);
return {
statusCode: 500,
body: "Server error",
Expand Down

0 comments on commit a87f4d9

Please sign in to comment.