MiddlewareMixin
This class provides a base implementation for middleware that supports both synchronous and asynchronous request processing. It automatically detects the execution mode based on the provided response handler and manages the transition between sync and async calling conventions. Developers can extend this mixin to implement custom request and response processing logic while maintaining compatibility across different execution environments.
Attributes
| Attribute | Type | Description |
|---|---|---|
| sync_capable | boolean = True | Boolean flag indicating if the middleware can handle synchronous requests. |
| async_capable | boolean = True | Boolean flag indicating if the middleware can handle asynchronous requests. |
Constructor
Signature
def MiddlewareMixin(
get_response: callable
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| get_response | callable | The next middleware or view in the chain to be called. |