[Discussion] Ordering of middlewares=
- 主要语言
- Python
- 星标
- 16.5k
- 派生
- 2.4k
- 平均合并
- 17 小时 22 分钟
- 30 天内合并 PR
- 212
描述
### Describe the bug
Some users try to use `Application(middlewares=...)` and then use the `setup()` functions from other libraries, which add their own middlewares.
This can cause problems due to the ordering of middlewares. I suspect that passing a list of middlewares like this makes users less aware of the ordering of middlewares at the end of their setup.
Maybe we should consider disallowing the passing of middlewares and require later `app.middlewares.append()` etc.?
Or, lock the middlewares when they have been passed in, such that it can't be mixed with `.append()` or `setup()`. This allows a user to pass a fixed sequence of middlewares that will never change. If they need to use `setup()` or similar, then they must add all their middlewares as a separate step, paying attention to what order to add them along with the `setup()` calls.
### Additional context
#6789
贡献指南
评估
这个 Issue 还没有评估数据。