-
-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interface to add WSGI middleware (#1814)
As discussed in #1807. Allowing the injection of WSGI middleware can enable easier migration from Connexion 2 to Connexion 3. The use cases are limited though, as this will only work for middleware that can work at the end of the middleware stack.
- Loading branch information
1 parent
563fbf8
commit 14e02fa
Showing
4 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
import types | ||
import typing as t | ||
|
||
ReturnType = t.TypeVar("ReturnType") | ||
MaybeAwaitable = t.Union[t.Awaitable[ReturnType], ReturnType] | ||
# Maybe Awaitable | ||
_ReturnType = t.TypeVar("_ReturnType") | ||
MaybeAwaitable = t.Union[t.Awaitable[_ReturnType], _ReturnType] | ||
|
||
# WSGIApp | ||
Environ = t.Mapping[str, object] | ||
|
||
_WriteCallable = t.Callable[[bytes], t.Any] | ||
_ExcInfo = t.Tuple[type, BaseException, types.TracebackType] | ||
|
||
_StartResponseCallable = t.Callable[ | ||
[ | ||
str, # status | ||
t.Sequence[t.Tuple[str, str]], # response headers | ||
], | ||
_WriteCallable, # write() callable | ||
] | ||
_StartResponseCallableWithExcInfo = t.Callable[ | ||
[ | ||
str, # status | ||
t.Sequence[t.Tuple[str, str]], # response headers | ||
t.Optional[_ExcInfo], # exc_info | ||
], | ||
_WriteCallable, # write() callable | ||
] | ||
StartResponse = t.Union[_StartResponseCallable, _StartResponseCallableWithExcInfo] | ||
ResponseStream = t.Iterable[bytes] | ||
|
||
WSGIApp = t.Callable[[Environ, StartResponse], ResponseStream] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters