Coverage for src / lexigram / contracts / web / middleware / protocols.py: 0%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-15 18:57 +0800

1"""Web middleware protocols for request/response processing guards.""" 

2 

3from __future__ import annotations 

4 

5from typing import Any, Protocol, runtime_checkable 

6 

7 

8@runtime_checkable 

9class ASGIMiddlewareProtocol(Protocol): 

10 """Protocol for ASGI-compatible middleware components. 

11 

12 Implements the ASGI callable interface so middleware can be 

13 wrapped around any ASGI application. 

14 """ 

15 

16 async def __call__( 

17 self, 

18 scope: dict[str, Any], 

19 receive: Any, 

20 send: Any, 

21 ) -> None: 

22 """Handle an ASGI request. 

23 

24 Args: 

25 scope: ASGI connection scope. 

26 receive: ASGI receive callable. 

27 send: ASGI send callable. 

28 """ 

29 ... 

30 

31 

32__all__ = ["ASGIMiddlewareProtocol"]