Skip to content

Commit 5e9eb16

Browse files
committed
Fixed the context bug
1 parent e1e7997 commit 5e9eb16

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/main/java/graphql/ExecutionInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static class Builder {
146146

147147
private String query;
148148
private String operationName;
149-
private Object context = GraphQLContext.newContext();
149+
private Object context = GraphQLContext.newContext().build();
150150
private Object root;
151151
private Map<String, Object> variables = Collections.emptyMap();
152152
private DataLoaderRegistry dataLoaderRegistry = new DataLoaderRegistry();

src/test/groovy/graphql/ExecutionInputTest.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ class ExecutionInputTest extends Specification {
4949
(executionInput.context as GraphQLContext).get("k2") == "v2"
5050
}
5151

52+
def "context is defaulted"() {
53+
when:
54+
def executionInput = ExecutionInput.newExecutionInput().query(query)
55+
.build()
56+
then:
57+
executionInput.context instanceof GraphQLContext
58+
}
59+
5260
def "transform works and copies values"() {
5361
when:
5462
def executionInputOld = ExecutionInput.newExecutionInput().query(query)

0 commit comments

Comments
 (0)