﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34074	'headers' argument for test RequestFactory/Client	Adam Johnson	David Wobrock	"We have `request.headers` since Django 2.2, but `RequestFactory`, and thus `Client`, still require using the awkward meta syntax for setting headers:

{{{
self.client.get(""/"", HTTP_ACCEPT_LANGUAGE=""en"")
}}}

I propose we add support for a `headers` argument that takes a dictionary like `request.headers`:

{{{
self.client.get(""/"", headers={""accept-language"": ""en""})
}}}

This would make tests easier to read and write, since they’d be consistent with `HttpRequest`.

(If this is accepted and merged, open a [https://github.com/adamchainz/django-upgrade/ django-upgrade] issue to rewrite request factory and client invocations.)"	New feature	closed	Testing framework	dev	Normal	fixed		David Wobrock	Ready for checkin	1	0	0	0	0	0
