diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4e264c8c0..ae763c6d964 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ All of the packages in the `apollo-server` repo are released with the same versi - express, koa: remove next after playground [#1436](https://github.com/apollographql/apollo-server/pull/1436) - Hapi: Pass the response toolkit to the context function. [#1407](https://github.com/apollographql/apollo-server/pull/1407) - update apollo-engine-reporting-protobuf to non-beta [#1429](https://github.com/apollographql/apollo-server/pull/1429) +- playground would use its own settings as default [#1516](https://github.com/apollographql/apollo-server/pull/1516) - Lambda: Look in event.path first when picking endpoint for GraphQL Playground [#1527](https://github.com/apollographql/apollo-server/pull/1527) - Fix to allow enabling GraphQL Playground in production with custom config [#1495](https://github.com/apollographql/apollo-server/pull/1495) diff --git a/packages/apollo-server-core/src/playground.ts b/packages/apollo-server-core/src/playground.ts index de35a837473..f92e8560fe4 100644 --- a/packages/apollo-server-core/src/playground.ts +++ b/packages/apollo-server-core/src/playground.ts @@ -49,13 +49,19 @@ export function createPlaygroundOptions( const playgroundOverrides = typeof playground === 'boolean' ? {} : playground || {}; + const settingsOverrides = playgroundOverrides.hasOwnProperty('settings') + ? { + settings: { + ...defaultPlaygroundOptions.settings, + ...playgroundOverrides.settings, + }, + } + : { settings: undefined }; + const playgroundOptions: PlaygroundRenderPageOptions = { ...defaultPlaygroundOptions, ...playgroundOverrides, - settings: { - ...defaultPlaygroundOptions.settings, - ...playgroundOverrides.settings, - }, + ...settingsOverrides, }; return playgroundOptions; diff --git a/packages/apollo-server-express/src/__tests__/ApolloServer.test.ts b/packages/apollo-server-express/src/__tests__/ApolloServer.test.ts index cde6547012d..960a1a3528a 100644 --- a/packages/apollo-server-express/src/__tests__/ApolloServer.test.ts +++ b/packages/apollo-server-express/src/__tests__/ApolloServer.test.ts @@ -171,6 +171,7 @@ describe('apollo-server-express', () => { reject(error); } else { expect(body).toMatch('GraphQLPlayground'); + expect(body).not.toMatch('settings'); expect(response.statusCode).toEqual(200); resolve(); }