mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #32159 -- Ensured AsyncRequestFactory correctly sets headers.
This commit is contained in:
parent
c2d4926702
commit
ebb08d1942
4 changed files with 36 additions and 3 deletions
|
@ -1012,3 +1012,14 @@ class AsyncRequestFactoryTest(SimpleTestCase):
|
|||
response = await async_generic_view(request)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, b'{"example": "data"}')
|
||||
|
||||
def test_request_factory_sets_headers(self):
|
||||
request = self.request_factory.get(
|
||||
'/somewhere/',
|
||||
AUTHORIZATION='Bearer faketoken',
|
||||
X_ANOTHER_HEADER='some other value',
|
||||
)
|
||||
self.assertEqual(request.headers['authorization'], 'Bearer faketoken')
|
||||
self.assertIn('HTTP_AUTHORIZATION', request.META)
|
||||
self.assertEqual(request.headers['x-another-header'], 'some other value')
|
||||
self.assertIn('HTTP_X_ANOTHER_HEADER', request.META)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue