Closed sasha-id closed 2 years ago
add_middleware
adds middleware in reverse order.
So in your case you have to use this order:
Also, add_middleware
is deprecated and it's no longer a recommended way to attach a middleware.
Thank you! it's working in reverse order. What's the recommended way to add middleware from the inside of inherited(Starlette) class?
call super.__init__(middleware=[...])
Perfect, thank you!
Hi Alex,
Trying to use starsessions with SessionAutoloadMiddleware and getting this erorr:
Here's my starlette setup:
Looks like the problem is here: https://github.com/alex-oleshkevich/starsessions/blob/4b86cad2cb02d21981e79399f74067e45fc9ba9f/starsessions/middleware.py#L61 Because of
scope["type"] == "lifespan"
the rest of the code is ignored. Am I missing something? Can you point me in the right direction?