diff --git a/graphql/context_operation.go b/graphql/context_operation.go index 8d6142ec3ff..2265a82b8c4 100644 --- a/graphql/context_operation.go +++ b/graphql/context_operation.go @@ -55,7 +55,7 @@ func GetOperationContext(ctx context.Context) *OperationContext { if val, ok := ctx.Value(operationCtx).(*OperationContext); ok { return val } - return nil + panic("missing operation context") } func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context { diff --git a/graphql/context_operation_test.go b/graphql/context_operation_test.go index d590055bbd5..1086c237fc1 100644 --- a/graphql/context_operation_test.go +++ b/graphql/context_operation_test.go @@ -9,8 +9,6 @@ import ( ) func TestGetOperationContext(t *testing.T) { - require.Nil(t, GetOperationContext(context.Background())) - rc := &OperationContext{} require.Equal(t, rc, GetOperationContext(WithOperationContext(context.Background(), rc))) }