Skip to content

GraphQlView: Do not 'instantiate_middleware' if middleware is already a MiddlewareManager #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion graphene_django/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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

Expand Down Expand Up @@ -86,7 +87,10 @@ def __init__(

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
Expand Down