Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: refactored gql-user-decorator to work for subscriptions

Balu Babu9c64721bf03f
diff --git a/packages/hoppscotch-backend/src/decorators/gql-user.decorator.ts b/packages/hoppscotch-backend/src/decorators/gql-user.decorator.ts
index 03c8fffe1..71042e069 100644
--- a/packages/hoppscotch-backend/src/decorators/gql-user.decorator.ts
+++ b/packages/hoppscotch-backend/src/decorators/gql-user.decorator.ts
@@ -4,7 +4,7 @@ import { GqlExecutionContext } from '@nestjs/graphql';
export const GqlUser = createParamDecorator(
(data: unknown, context: ExecutionContext) => {
const ctx = GqlExecutionContext.create(context);
- return ctx.getContext().req.user;
+ const { req, headers } = ctx.getContext();
+ return headers ? headers.user : req.user;
},
);
-