From 0aac046a0e8e116ea66d1a322d552b44ae9244e8 Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Wed, 8 Feb 2023 14:27:24 +0530 Subject: [PATCH] refactor: changed context to contain just req,res and connection objects for GraphQLModule --- packages/hoppscotch-backend/src/app.module.ts | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/hoppscotch-backend/src/app.module.ts b/packages/hoppscotch-backend/src/app.module.ts index cbb9cd49c..c0e541604 100644 --- a/packages/hoppscotch-backend/src/app.module.ts +++ b/packages/hoppscotch-backend/src/app.module.ts @@ -34,21 +34,11 @@ import { UserHistoryModule } from './user-history/user-history.module'; }, }, }, - context: async ({ req, connection }) => { - if (req) { - return { reqHeaders: req.headers }; - } else { - return { - // Lowercase the keys - reqHeaders: Object.fromEntries( - Object.entries(connection.context).map(([k, v]) => [ - k.toLowerCase(), - v, - ]), - ), - }; - } - }, + context: ({ req, res, connection }) => ({ + req, + res, + connection, + }), driver: ApolloDriver, }), UserModule,