diff --git a/packages/graphql-yoga/src/plugins/use-graphiql.ts b/packages/graphql-yoga/src/plugins/use-graphiql.ts index 3e4eba59bf..99653a817f 100644 --- a/packages/graphql-yoga/src/plugins/use-graphiql.ts +++ b/packages/graphql-yoga/src/plugins/use-graphiql.ts @@ -98,12 +98,12 @@ export function useGraphiQL>( }; return { async onRequest({ request, serverContext, fetchAPI, endResponse, url }) { - const requestedUrl = request.url.split('?')[0]; if ( shouldRenderGraphiQL(request) && - (requestedUrl.endsWith(config.graphqlEndpoint) || - requestedUrl.endsWith(`${config.graphqlEndpoint}/`) || + (request.url.endsWith(config.graphqlEndpoint) || + request.url.endsWith(`${config.graphqlEndpoint}/`) || url.pathname === config.graphqlEndpoint || + url.pathname === `${config.graphqlEndpoint}/` || getUrlPattern(fetchAPI).test(url)) ) { logger.debug(`Rendering GraphiQL`); diff --git a/packages/graphql-yoga/src/plugins/use-unhandled-route.ts b/packages/graphql-yoga/src/plugins/use-unhandled-route.ts index 89a074f0f4..9d4ad44e6e 100644 --- a/packages/graphql-yoga/src/plugins/use-unhandled-route.ts +++ b/packages/graphql-yoga/src/plugins/use-unhandled-route.ts @@ -15,11 +15,11 @@ export function useUnhandledRoute(args: { } return { onRequest({ request, fetchAPI, endResponse, url }) { - const requestedUrl = request.url.split('?')[0]; if ( - !requestedUrl.endsWith(args.graphqlEndpoint) && - !requestedUrl.endsWith(`${args.graphqlEndpoint}/`) && + !request.url.endsWith(args.graphqlEndpoint) && + !request.url.endsWith(`${args.graphqlEndpoint}/`) && url.pathname !== args.graphqlEndpoint && + url.pathname !== `${args.graphqlEndpoint}/` && !getUrlPattern(fetchAPI).test(url) ) { if (