Skip to content

Keep a list of middleware resolvers #16

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
Nov 25, 2018
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: 3 additions & 3 deletions graphql/execution/middleware.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from functools import partial, reduce
from inspect import isfunction

from typing import Callable, Iterator, Dict, Tuple, Any, Optional
from typing import Callable, Iterator, Dict, List, Tuple, Any, Optional

__all__ = ["MiddlewareManager"]

Expand All @@ -23,12 +23,12 @@ class MiddlewareManager:
__slots__ = "middlewares", "_middleware_resolvers", "_cached_resolvers"

_cached_resolvers: Dict[GraphQLFieldResolver, GraphQLFieldResolver]
_middleware_resolvers: Optional[Iterator[Callable]]
_middleware_resolvers: Optional[List[Callable]]

def __init__(self, *middlewares: Any) -> None:
self.middlewares = middlewares
self._middleware_resolvers = (
get_middleware_resolvers(middlewares) if middlewares else None
list(get_middleware_resolvers(middlewares)) if middlewares else None
)
self._cached_resolvers = {}

Expand Down