Opened 5 years ago
Last modified 4 years ago
#30997 closed Cleanup/optimization
Deprecate HttpRequest.is_ajax — at Initial Version
Reported by: | Adam Johnson | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As discussed on [this django-developers thread](https://groups.google.com/d/msg/django-developers/F8F5b1kEA34/FhqCmRw9BwAJ) this should be deprecated.
It inspects the non-standard header X-Requested-Wiith that is set by jQuery and maybe other frameworks. However jQuery's popularity, especially for making requests, is decreasing thanks to changes such as the new fetch()
JS API.
Also in the cases this property is used to determine the kind of content to send to a client, it'd be better to inspect the HTTP standard Accept
header.
For these reasons Flask has deprecated its similar property is_xhr
.