Skip to content

Commit 706927d

Browse files
committed
fix: move introspection code to config
1 parent a1314b8 commit 706927d

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

src/common/config/graphql-config.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class GraphqlConfigService implements GqlOptionsFactory<ApolloDriverConfi
3939
context: ({ req }) => ({ req }),
4040
cache: 'bounded',
4141
csrfPrevention: this.configService.get('NODE_ENV') !== 'development',
42+
introspection: this.configService.get('NODE_ENV') === 'development',
4243
};
4344
}
4445
}

src/main.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ async function bootstrap() {
4141
graphqlUploadExpress({ maxFileSize: 1000 * 1000 * 10, maxFiles: 10 }),
4242
(req: Request, res: Response, next: NextFunction) => {
4343
const accept = req.headers.accept || '';
44-
if (
45-
accept.includes(GRAPHQL_HEADER_KEY) ||
46-
req.method !== 'POST' ||
47-
req.body?.operationName === 'IntrospectionQuery'
48-
) {
44+
if (accept.includes(GRAPHQL_HEADER_KEY) || req.method !== 'POST') {
4945
return next();
5046
}
5147

0 commit comments

Comments
 (0)