Content-Length: 276698 | pFad | http://github.com/fastapi/fastapi/pull/13699

19 📝 Clarify the middleware execution order in docs by YuriiMotov · Pull Request #13699 · fastapi/fastapi · GitHub
Skip to content

📝 Clarify the middleware execution order in docs #13699

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YuriiMotov
Copy link
Contributor

At the moment, it's not obvious for newcomers what the order of middleware execution is when more than one middleware is added.

This PR adds clarification on the stacking behavior of middlewares in FastAPI.

Specifically, it explains that the last middleware added is the outermost, which runs first on the request and last on the response.

@YuriiMotov YuriiMotov added the docs Documentation about how to use FastAPI label May 9, 2025
Copy link
Contributor

github-actions bot commented May 9, 2025

Copy link

@schneebuzz schneebuzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good addition, I would even add a link to the new section on the top bulletpoints, e.g.

- Then it passes the request to be processed by the rest of the application (by some path operation *or the next middleware, see [...]*).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation about how to use FastAPI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/fastapi/fastapi/pull/13699

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy