From 60c0be1e50cdc1d30150cde424e198baa40926a6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 10 Apr 2019 14:14:24 +0200 Subject: [PATCH] doc: fix middleware (#471) --- docs/middleware.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/middleware.md b/docs/middleware.md index 294ad7b1..f4cd2a69 100644 --- a/docs/middleware.md +++ b/docs/middleware.md @@ -165,13 +165,13 @@ app.add_middleware(CustomHeaderMiddleware) If you want to provide configuration options to the middleware class you should override the `__init__` method, ensuring that the first argument is `app`, and any remaining arguments are optional keyword arguments. Make sure to set the `app` -attribute on the class if you do this. +attribute on the instance if you do this. ```python class CustomHeaderMiddleware(BaseHTTPMiddleware): def __init__(self, app, header_value='Example'): self.app = app - self.header_value + self.header_value = header_value async def dispatch(self, request, call_next): response = await call_next(request)