Merge remote-tracking branch 'apollostack/master' into catch-formatError

This commit is contained in:
Nicolás López 2016-10-17 16:02:38 -03:00
commit 27cfded665
2 changed files with 13 additions and 1 deletions

View file

@ -29,7 +29,7 @@ const apolloHapi: IRegister = function(server: Server, options: HapiPluginOption
const config = Object.assign(options.route || {}, {
plugins: {
graphql: options.apolloOptions,
graphql: isOptionsFunction(options.apolloOptions) ? options.apolloOptions : () => options.apolloOptions,
},
pre: [{
assign: 'isBatch',

View file

@ -6,6 +6,7 @@ import {
GraphQLObjectType,
GraphQLString,
GraphQLError,
introspectionQuery,
BREAK,
} from 'graphql';
@ -261,6 +262,17 @@ export default (createApp: CreateAppFunc, destroyApp?: DestroyAppFunc) => {
});
});
it('can handle introspection request', () => {
app = createApp();
const req = request(app)
.post('/graphql')
.send({query: introspectionQuery});
return req.then((res) => {
expect(res.status).to.equal(200);
return expect(res.body.data.__schema.types[0].fields[0].name).to.equal('testString');
});
});
it('can handle batch requests', () => {
app = createApp();
const expected = [