(test_client_factory: TestClientFactory)
| 46 | reason=&class="cm">#x27;urllib3 includes class="st">"br" to the class="st">"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({class="st">"headers": headers}) |
| 53 | await response(scope, receive, send) |
| 54 | |
| 55 | client = test_client_factory(app) |
| 56 | response = client.get(class="st">"/", headers={class="st">"host": class="st">"example.org"}) |
| 57 | assert response.json() == { |
| 58 | class="st">"headers": { |
| 59 | class="st">"host": class="st">"example.org", |
| 60 | class="st">"user-agent": class="st">"testclient", |
| 61 | class="st">"accept-encoding": class="st">"gzip, deflate, zstd", |
| 62 | class="st">"accept": class="st">"*/*", |
| 63 | class="st">"connection": class="st">"keep-alive", |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected