mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00

The express-graphql reference implementation [provides a check] (2e27a73358/src/index.js (L201-L208)
) to protect against cases where a GET request is made that does not have a `query` parameter where the GraphQL query would be present. Without this guard, graphql-js's `parse` will return `undefined` for the `DocumentNode` since it has no document to read. Subsequently passing this to `isQueryOperation` results in a `TypeError`, because we are providing `undefined` where `getOperationAst` [expects to get a DocumentNode](5fe39262a3/src/utilities/getOperationAST.js (L19)
). A new test file is added for `runHttpQuery`, as one previously did not seem to exist.
26 lines
1.4 KiB
JavaScript
26 lines
1.4 KiB
JavaScript
const NODE_VERSION = process.version.split('.');
|
|
const NODE_MAJOR_VERSION = parseInt(NODE_VERSION[0].replace(/^v/, ''));
|
|
const NODE_MAJOR_REVISION = parseInt(NODE_VERSION[1]);
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
require('../packages/apollo-server-core/dist/runQuery.test.js');
|
|
require('../packages/apollo-server-core/dist/runHttpQuery.test.js');
|
|
require('../packages/apollo-server-module-operation-store/dist/operationStore.test');
|
|
NODE_MAJOR_VERSION >= 7 &&
|
|
require('../packages/apollo-server-adonis/dist/adonisApollo.test');
|
|
require('../packages/apollo-server-express/dist/expressApollo.test');
|
|
require('../packages/apollo-server-express/dist/connectApollo.test');
|
|
(NODE_MAJOR_VERSION >= 9 ||
|
|
(NODE_MAJOR_VERSION >= 8 && NODE_MAJOR_REVISION >= 9)) &&
|
|
require('../packages/apollo-server-hapi/dist/hapiApollo.test'); // Hapi 17 is 8.9+
|
|
NODE_MAJOR_VERSION >= 6 &&
|
|
require('../packages/apollo-server-micro/dist/microApollo.test');
|
|
NODE_MAJOR_VERSION >= 7 &&
|
|
require('../packages/apollo-server-koa/dist/koaApollo.test');
|
|
require('../packages/apollo-server-lambda/dist/lambdaApollo.test');
|
|
require('../packages/apollo-server-azure-functions/dist/azureFunctionsApollo.test');
|
|
require('../packages/apollo-server-express/dist/apolloServerHttp.test');
|
|
|
|
// XXX: Running restify last as it breaks http.
|
|
// for more info: https://github.com/restify/node-restify/issues/700
|
|
require('../packages/apollo-server-restify/dist/restifyApollo.test');
|