Skip to content

Commit 1cced50

Browse files
committed
Add sequence diagram to middleware execution order docs
1 parent ecf73d6 commit 1cced50

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docs/en/docs/tutorial/middleware.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ This results in the following execution order:
8888

8989
This stacking behavior ensures that middlewares are executed in a predictable and controllable order.
9090

91+
```mermaid
92+
sequenceDiagram
93+
participant Client
94+
participant C as Middleware C<br/>(added last · outermost)
95+
participant B as Middleware B<br/>(added second)
96+
participant A as Middleware A<br/>(added first · innermost)
97+
participant App as FastAPI app
98+
99+
Client ->> C: Request
100+
C ->> B: Request
101+
B ->> A: Request
102+
A ->> App: Request
103+
App -->> A: Response
104+
A -->> B: Response
105+
B -->> C: Response
106+
C -->> Client: Response
107+
```
108+
91109
## Other middlewares { #other-middlewares }
92110

93111
You can later read more about other middlewares in the [Advanced User Guide: Advanced Middleware](../advanced/middleware.md).

0 commit comments

Comments
 (0)