Skip to content

Commit

Permalink
Merge pull request #154 from HriBB/master
Browse files Browse the repository at this point in the history
Pass ctx instead of ctx.request to koa options function
  • Loading branch information
helfer authored Oct 1, 2016
2 parents 3f92b96 + 5997b48 commit 47fd535
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/integrations/koaApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloOptions from './apolloOptions';
import * as GraphiQL from '../modules/renderGraphiQL';

export interface KoaApolloOptionsFunction {
(req: koa.Request): ApolloOptions | Promise<ApolloOptions>;
(ctx: koa.Context): ApolloOptions | Promise<ApolloOptions>;
}

export interface KoaHandler {
Expand All @@ -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}`;
Expand Down

0 comments on commit 47fd535

Please sign in to comment.