mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #30997 -- Deprecated HttpRequest.is_ajax().
This commit is contained in:
parent
7fa0fa45c5
commit
e348ab0d43
6 changed files with 31 additions and 1 deletions
12
tests/requests/test_is_ajax_deprecations.py
Normal file
12
tests/requests/test_is_ajax_deprecations.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from django.http import HttpRequest
|
||||
from django.test import SimpleTestCase, ignore_warnings
|
||||
from django.utils.deprecation import RemovedInDjango40Warning
|
||||
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango40Warning)
|
||||
class TestDeprecatedIsAjax(SimpleTestCase):
|
||||
def test_is_ajax(self):
|
||||
request = HttpRequest()
|
||||
self.assertIs(request.is_ajax(), False)
|
||||
request.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
|
||||
self.assertIs(request.is_ajax(), True)
|
Loading…
Add table
Add a link
Reference in a new issue