From 98569deae66ac55fd2ce3e8323743fccca09fef6 Mon Sep 17 00:00:00 2001 From: Eddy Chen <89349085+ecxyzzy@users.noreply.github.com> Date: Sun, 10 Sep 2023 22:15:34 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20test=20logging=20both=20t?= =?UTF-8?q?ypes=20of=20headers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/routes/v1/graphql/+endpoint.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/api/src/routes/v1/graphql/+endpoint.ts b/apps/api/src/routes/v1/graphql/+endpoint.ts index b0d5ed9c..9e0cb953 100644 --- a/apps/api/src/routes/v1/graphql/+endpoint.ts +++ b/apps/api/src/routes/v1/graphql/+endpoint.ts @@ -32,8 +32,9 @@ const graphqlServer = new ApolloServer({ }); export const ANY: APIGatewayProxyHandler = async (event) => { - const { body, headers: eventHeaders, httpMethod: method } = event; + const { body, headers: eventHeaders, multiValueHeaders, httpMethod: method } = event; logger.info(eventHeaders); + logger.info(multiValueHeaders); try { graphqlServer.assertStarted(""); @@ -43,7 +44,7 @@ export const ANY: APIGatewayProxyHandler = async (event) => { const req: HTTPGraphQLRequest = { body, - headers: Object.entries(eventHeaders).reduce( + headers: Object.entries(eventHeaders ?? { "content-encoding": "application/json" }).reduce( (m, [k, v]) => m.set(k, Array.isArray(v) ? v.join(", ") : v ?? ""), new HeaderMap(), ),