Skip to content
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

Improve Documentation on Writing Custom ASGI Middleware and BaseHTTPMiddleware #1029

Closed
erewok opened this issue Aug 13, 2020 · 1 comment · Fixed by #1640 or #1656
Closed

Improve Documentation on Writing Custom ASGI Middleware and BaseHTTPMiddleware #1029

erewok opened this issue Aug 13, 2020 · 1 comment · Fixed by #1640 or #1656
Assignees
Labels
documentation Project documentation

Comments

@erewok
Copy link
Contributor

erewok commented Aug 13, 2020

In light of the issues and PRs relating to BaseHTTPMiddleware we need to improve the documentation on this middleware class and give some good guidance on how to write custom middleware. Documentation on this should include the following:

  • A warning not to use BaseHTTPMiddleware with StreamingResponse or FileResponse endpoints.
  • A note on how background will be evaluated with respect to BaseHTTPMiddleware.
  • Instructions on how to write custom ASGI Middleware with example code (can be based on an example from the codebase).
  • A gentle suggestion to favor custom ASGI Middleware over subclassing BaseHTTPMiddleware.

See related issues and PRs:

@Kludex
Copy link
Member

Kludex commented May 22, 2022

I think we should also document on how to create middlewares without BaseHTTPMiddleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Project documentation
Projects
None yet
2 participants