#26590 closed New feature (wontfix)
Make AJAX requests in the test client using a kwarg. ie. ajax=True
Reported by: | Neil Lyons | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.9 |
Severity: | Normal | Keywords: | ajax |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Has it been suggested before to simulate an AJAX request by passing a boolean instead of HTTP_X_REQUESTED_WITH='XMLHttpRequest'? ie self.client.get("/foobar", ajax=True)
I'm sure people would use this as it is easier to remember. I always need to Google how to make AJAX requests in the test client as HTTP_X_REQUESTED_WITH='XMLHttpRequest' isn't particularly memorable.
Change History (2)
comment:1 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 6 years ago
I think it would make sense to think about this again.
ajax=True is really convenient and easy to remember.
I think it would be very nice to have the ajax=True shortcut.
It is like the existing "is_ajax()" method which is convenient and easy to remember.
I don't think adding more than one way to do that is a good idea. You can always do this in your own subclass if you want to.