Skip to content

Commit

Permalink
fix: add cloning of context prototype for batch queries
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyhobart committed Dec 10, 2017
1 parent fac797e commit 3d531b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/apollo-server-core/src/runHttpQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function isQueryOperation(query: DocumentNode, operationName: string) {
return operationAST.operation === 'query';
}

export function isFunction(arg: any): arg is Function {
function isFunction(arg: any): arg is Function {
return typeof arg === 'function';
}

Expand Down Expand Up @@ -101,11 +101,11 @@ export async function runHttpQuery(handlerArguments: Array<any>, request: HttpQu
}
}

let context = optionsObject.context;
let context = optionsObject.context || {};
if (isFunction(context)) {
context = context();
} else if (isBatch) {
context = Object.assign({}, context || {});
context = Object.assign({}, Object.getPrototypeOf(context), context);
}

let params = {
Expand Down

0 comments on commit 3d531b6

Please sign in to comment.