Skip to content

Commit 2a23ede

Browse files
committed
GH-22: Call the default middleware for non-http requests
1 parent d88ec2b commit 2a23ede

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/fastapi_oauth2/middleware.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ def __init__(
139139
config = OAuth2Config(**config)
140140
elif not isinstance(config, OAuth2Config):
141141
raise TypeError("config is not a valid type")
142+
self.default_application_middleware = app
142143
self.auth_middleware = AuthenticationMiddleware(app, backend=OAuth2Backend(config, callback), **kwargs)
143144

144145
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
145-
await self.auth_middleware(scope, receive, send)
146+
if scope["type"] == "http":
147+
return await self.auth_middleware(scope, receive, send)
148+
await self.default_application_middleware(scope, receive, send)

0 commit comments

Comments
 (0)