diff --git a/graphene_django/views.py b/graphene_django/views.py index 4c58839..16bf34b 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -15,6 +15,7 @@ from graphql.error import format_error as format_graphql_error from graphql.error import GraphQLError from graphql.execution import ExecutionResult from graphql.type.schema import GraphQLSchema +from graphql.execution.middleware import MiddlewareManager from .settings import graphene_settings @@ -86,7 +87,10 @@ class GraphQLView(View): self.schema = self.schema or schema if middleware is not None: - self.middleware = list(instantiate_middleware(middleware)) + if isinstance(middleware, MiddlewareManager): + self.middleware = middleware + else: + self.middleware = list(instantiate_middleware(middleware)) self.executor = executor self.root_value = root_value self.pretty = self.pretty or pretty