diff --git a/CHANGELOG.md b/CHANGELOG.md index ebf81b54f6d..cc4f82ef184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ### VNEXT +* Pass `ctx` instead of `ctx.request` to options function in Koa integration ([@HriBB](https://github.com/HriBB)) in [PR #154](https://github.com/apollostack/apollo-server/pull/154) ### v0.3.2 * Added missing exports for hapi integration ([@nnance](https://github.com/nnance)) in [PR #152](https://github.com/apollostack/apollo-server/pull/152) diff --git a/src/integrations/koaApollo.ts b/src/integrations/koaApollo.ts index 386e83c5200..e9fb76a3ee7 100644 --- a/src/integrations/koaApollo.ts +++ b/src/integrations/koaApollo.ts @@ -5,7 +5,7 @@ import ApolloOptions from './apolloOptions'; import * as GraphiQL from '../modules/renderGraphiQL'; export interface KoaApolloOptionsFunction { - (req: koa.Request): ApolloOptions | Promise; + (ctx: koa.Context): ApolloOptions | Promise; } export interface KoaHandler { @@ -25,7 +25,7 @@ export function apolloKoa(options: ApolloOptions | KoaApolloOptionsFunction): Ko let optionsObject: ApolloOptions; if (isOptionsFunction(options)) { try { - optionsObject = await options(ctx.request); + optionsObject = await options(ctx); } catch (e) { ctx.status = 500; return ctx.body = `Invalid options provided to ApolloServer: ${e.message}`;