Method
__call__
tests/test_routing.py:803–811
· tests/test_routing.py::AddHeadersMiddleware.__call__
(self, scope: Scope, receive: Receive, send: Send)
Source from the content-addressed store, hash-verified
| 801 | self.app = app |
| 802 | |
| 803 | async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: |
| 804 | scope[class="st">"add_headers_middleware"] = True |
| 805 | |
| 806 | async def modified_send(msg: Message) -> None: |
| 807 | if msg[class="st">"type"] == class="st">"http.response.start": |
| 808 | msg[class="st">"headers"].append((bclass="st">"X-Test", bclass="st">"Set by middleware")) |
| 809 | await send(msg) |
| 810 | |
| 811 | await self.app(scope, receive, modified_send) |
| 812 | |
| 813 | |
| 814 | def assert_middleware_header_route(request: Request) -> Response: |
Callers
nothing calls this directly
Tested by
no test coverage detected