diff options
| author | David Wobrock <david.wobrock@gmail.com> | 2022-10-09 22:33:35 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-11-14 10:21:51 +0100 |
| commit | 67da22f08e05018ea968fcacbac9ac37ea925d85 (patch) | |
| tree | 86c50e012c53b6f7910e1d221e98a7195441e335 /docs/releases | |
| parent | b181cae2e3697b2e53b5b67ac67e59f3b05a6f0d (diff) | |
Fixed #34074 -- Added headers argument to RequestFactory and Client classes.
Diffstat (limited to 'docs/releases')
| -rw-r--r-- | docs/releases/4.2.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/releases/4.2.txt b/docs/releases/4.2.txt index 39cf05f23b..3951a617e0 100644 --- a/docs/releases/4.2.txt +++ b/docs/releases/4.2.txt @@ -279,6 +279,22 @@ Tests * The :option:`test --debug-sql` option now formats SQL queries with ``sqlparse``. +* The :class:`~django.test.RequestFactory`, + :class:`~django.test.AsyncRequestFactory`, :class:`~django.test.Client`, and + :class:`~django.test.AsyncClient` classes now support the ``headers`` + parameter, which accepts a dictionary of header names and values. This allows + a more natural syntax for declaring headers. + + .. code-block:: python + + # Before: + self.client.get("/home/", HTTP_ACCEPT_LANGUAGE="fr") + await self.async_client.get("/home/", ACCEPT_LANGUAGE="fr") + + # After: + self.client.get("/home/", headers={"accept-language": "fr"}) + await self.async_client.get("/home/", headers={"accept-language": "fr"}) + URLs ~~~~ |
