Skip to content

Commit

Permalink
Always clone the context if it's not a function
Browse files Browse the repository at this point in the history
Fixes #1247.
  • Loading branch information
martijnwalraven committed Jun 26, 2018
1 parent 84f13ba commit 7e35305
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/apollo-server-core/src/runHttpQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ export async function runHttpQuery(
e.message = `Context creation failed: ${e.message}`;
throwHttpGraphQLError(500, [e], optionsObject);
}
} else if (isBatch) {
} else {
// Always clone the context if it's not a function, because that preserves
// having a fresh context per request.
context = Object.assign(
Object.create(Object.getPrototypeOf(context)),
context,
Expand Down

0 comments on commit 7e35305

Please sign in to comment.