(exchange: _CopilotRequestExchange)
| 672 | |
| 673 | |
| 674 | async def _build_httpx_request(exchange: _CopilotRequestExchange) -> httpx.Request: |
| 675 | import httpx |
| 676 | |
| 677 | header_pairs = [ |
| 678 | (name, value) |
| 679 | for name, values in exchange.headers.items() |
| 680 | if name.lower() not in _FORBIDDEN_REQUEST_HEADERS |
| 681 | for value in (values or []) |
| 682 | ] |
| 683 | method = exchange.method.upper() |
| 684 | has_body = method not in ("GET", "HEAD") |
| 685 | body = await _drain_async(exchange.request_body) |
| 686 | content = body if (has_body and body) else None |
| 687 | return httpx.Request(method, exchange.url, headers=header_pairs, content=content) |
| 688 | |
| 689 | |
| 690 | async def _drain_async(stream: AsyncIterator[bytes]) -> bytes: |
no test coverage detected
searching dependent graphs…