]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Reword bug -> limitation for BaseHTTPMiddleware (#1716)
authorAdrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
Thu, 30 Jun 2022 23:56:28 +0000 (16:56 -0700)
committerGitHub <noreply@github.com>
Thu, 30 Jun 2022 23:56:28 +0000 (16:56 -0700)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
docs/middleware.md

index e51c4583e3ee8f6abd1da0af345cb9f9f29b58ec..8f063dec399b47c59d37ce4eef6db1709575bb71 100644 (file)
@@ -226,8 +226,8 @@ Middleware classes should not modify their state outside of the `__init__` metho
 Instead you should keep any state local to the `dispatch` method, or pass it
 around explicitly, rather than mutating the middleware instance.
 
-!!! bug
-    Currently, the `BaseHTTPMiddleware` has some known issues:
+!!! warning
+    Currently, the `BaseHTTPMiddleware` has some known limitations:
 
     - It's not possible to use `BackgroundTasks` with `BaseHTTPMiddleware`. Check [#1438](https://github.com/encode/starlette/issues/1438) for more details.
     - Using `BaseHTTPMiddleware` will prevent changes to [`contextlib.ContextVar`](https://docs.python.org/3/library/contextvars.html#contextvars.ContextVar)s from propagating upwards. That is, if you set a value for a `ContextVar` in your endpoint and try to read it from a middleware you will find that the value is not the same value you set in your endpoint (see [this test](https://github.com/encode/starlette/blob/621abc747a6604825190b93467918a0ec6456a24/tests/middleware/test_base.py#L192-L223) for an example of this behavior).