Skip to content

Commit 975f45e

Browse files
authored
GraphQlView: Do not 'instantiate_middleware' if middleware is already a MiddlewareManager (#952)
1 parent 894c564 commit 975f45e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

graphene_django/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from graphql.error import GraphQLError
1616
from graphql.execution import ExecutionResult
1717
from graphql.type.schema import GraphQLSchema
18+
from graphql.execution.middleware import MiddlewareManager
1819

1920
from .settings import graphene_settings
2021

@@ -86,7 +87,10 @@ def __init__(
8687

8788
self.schema = self.schema or schema
8889
if middleware is not None:
89-
self.middleware = list(instantiate_middleware(middleware))
90+
if isinstance(middleware, MiddlewareManager):
91+
self.middleware = middleware
92+
else:
93+
self.middleware = list(instantiate_middleware(middleware))
9094
self.executor = executor
9195
self.root_value = root_value
9296
self.pretty = self.pretty or pretty

0 commit comments

Comments
 (0)