(test_client_factory: TestClientFactory)
| 46 | reason='urllib3 includes "br" to the "accept-encoding" headers.', |
| 47 | ) |
| 48 | def test_request_headers(test_client_factory: TestClientFactory) -> None: |
| 49 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 50 | request = Request(scope, receive) |
| 51 | headers = dict(request.headers) |
| 52 | response = JSONResponse({"headers": headers}) |
| 53 | await response(scope, receive, send) |
| 54 | |
| 55 | client = test_client_factory(app) |
| 56 | response = client.get("/", headers={"host": "example.org"}) |
| 57 | assert response.json() == { |
| 58 | "headers": { |
| 59 | "host": "example.org", |
| 60 | "user-agent": "testclient", |
| 61 | "accept-encoding": "gzip, deflate, zstd", |
| 62 | "accept": "*/*", |
| 63 | "connection": "keep-alive", |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected