You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it is very similar to django's [MiddlewareMixin](https://docs.djangoproject.com/en/5.1/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware)
6
+
with the following specification:
7
+
8
+
`__call__` method is async, so you need to `await` the middleware instance.
where `get_response` is an async function, sync functions are not supported and will raise an error.
14
+
15
+
----------------------------
16
+
17
+
other methods are as follows:
18
+
19
+
*`process_request` and `process_response` are `await`ed inside the middleware and have to be async
20
+
21
+
*`process_view` and `process_template_response` can be either sync or async, but **async is preferred**, if it's sync django will wrap it as async which might have slight performance reduction.
22
+
23
+
*`process_exception` can be either sync or async, but **sync is preferred**, if async is used django wraps the method to be called synchronously.
0 commit comments