-
Notifications
You must be signed in to change notification settings - Fork 86
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
Move to ASGI middleware implementation? #98
Comments
If help wanted, let me know. |
While I don't have any strong opinion either way, the proposal you linked to seems to still be under heavy discussion (last comment there was after this ticket was opened). I don't really have much time to dig into this, but happy for others to contribute and accept a PR around this. I would just suggest trying to follow whatever the folks at |
There are generally no downsides to using pure ASGI middleware and there are some small upsides like better performance (BaseHTTPMiddleware creates queues, tasks, etc.). Are you concerned about backwards compatibility? I think it would only be an issue if you had users subclassing |
Hi, for my particular use-case, I need the middleware to be a pure ASGI middleware, since I want to use background tasks as well. According to my tests, and starlette's documentation.
I'm currently writing it in my application and I'm almost done. It would be a pleasure to contribute to this project with my ASGI implementation of the SlowAPIMiddleware. |
It's possible to use PR that removes that note from the docs: encode/starlette#1874. |
IMHO, shifting from the BaseHTTPMiddleware to pure ASGI would be a major revision and would need more review before merge. I think contributing it as a second middleware would be the easiest path forward at this point. |
@Kludex good catch, anyway I'm using fastAPI which have a strict dependency on 0.20.4 for now 😄 |
For those interested, here is the associated PR for the ASGI middleware I wrote: #113 |
There's been an uptick in issues (1, 2, 3, etc.) around Starlette's BaseHTTPMiddleware class, so much so that some are proposing to deprecate it.
Should we shift the implementation to be a completely ASGI-based implementation?
The text was updated successfully, but these errors were encountered: