(request: Any, call_next: Callable[[Any], Any])
| 1420 | |
| 1421 | def test_stream_over_a_response_that_a_middleware_made_from_bytes(self, spans: Spans) -> None: |
| 1422 | def replay(request: Any, call_next: Callable[[Any], Any]) -> Any: |
| 1423 | sent = call_next(request) |
| 1424 | sent.close() |
| 1425 | # The body of a response that is made from bytes is a sync and an async one at once. |
| 1426 | raw = stream_response() |
| 1427 | return APIResponse( |
| 1428 | raw=raw, |
| 1429 | cast_to=request.cast_to, |
| 1430 | client=client, |
| 1431 | stream=True, |
| 1432 | stream_cls=request.stream_cls, |
| 1433 | options=request.options, |
| 1434 | ) |
| 1435 | |
| 1436 | transport = httpx2.MockTransport(lambda _: stream_response()) |
| 1437 | client = make_client(spans, http_client=httpx2.Client(transport=transport), middleware=[replay]) |
nothing calls this directly
no test coverage detected