django-rest-framework/tests
Jesse London 9c9ffb18f4
made Browsable API base template cachable: omit CSRF token when unnecessary (#7717)
HTML responses generated by the Browsable API otherwise generate
inconsistent ETAGs -- due to the presence of CSRF tokens in the response
-- even when the API is read-only, (and as such when the response
contains no resource-modifying forms, i.e. neither POST nor PUT forms,
which might require the CSRF token).

While the template was appropriately including CSRF tokens only within
POST and PUT forms, its AJAX overlay included the CSRF token in *every*
response, regardless of whether it would be needed.

This change brings the logic of the `script` block into line with that
of the rest of the template -- and such that read-only APIs (and really
the Browsable API pages of *any* read-only resources) will not
needlessly include the CSRF token, and will now be safely cachable -- by
both back-end systems and by the user agent.
2021-03-16 13:25:21 +00:00
..
authentication Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
browsable_api Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
generic_relations Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
importable Fix lazy translation of ListField errors (#6708) 2019-05-22 19:41:53 -07:00
schemas Fix OpenAPISchema rendering for timedelta (#7641) 2021-03-10 12:03:15 +00:00
__init__.py Support for running the test suite with py.test 2014-03-02 12:40:30 +01:00
conftest.py support multi db atomic_requests (#7739) 2021-03-03 11:15:39 +00:00
models.py Fix pk-only optimization for properties (#7142) 2020-09-03 11:49:15 +01:00
test_api_client.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_atomic_requests.py support multi db atomic_requests (#7739) 2021-03-03 11:15:39 +00:00
test_authtoken.py Fix: authtoken.TokenProxy cannot be proxy when not installed (#7571) 2020-10-09 12:16:15 +01:00
test_bound_fields.py Render JSON fields with proper indentation in browsable API forms. (#6243) 2021-03-15 10:44:03 +00:00
test_decorators.py Minor test improvements (#7297) 2020-04-29 11:21:42 +01:00
test_description.py Bumped Markdown version to 3.3 (#7590) 2020-10-13 17:27:08 +01:00
test_encoders.py JSONEncoder: ensure empty listlikes remain lists, not dicts (#6794) 2019-07-09 11:41:05 +01:00
test_exceptions.py Replace all usage ugettext functions with the non-u versions (#6634) 2019-05-01 07:49:54 +02:00
test_fields.py Respect allow_null=True on DecimalFields (#7718) 2021-03-09 10:49:03 +00:00
test_filters.py Ordering filter bug with model property serializer field (#7609) 2021-03-16 12:53:39 +00:00
test_generics.py Allow context to be provided to get_serializer (#7298) 2020-04-29 11:19:44 +01:00
test_htmlrenderer.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_lazy_hyperlinks.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_metadata.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_middleware.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_model_serializer.py Dropped test compatibility shims for Django <2.2. (#7523) 2020-09-07 20:00:17 +02:00
test_multitable_inheritance.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_negotiation.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_one_to_one_with_inheritance.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_pagination.py Added example for pagination in schemas. (#7275) 2020-04-24 16:13:13 +02:00
test_parsers.py Drop default 'utf-8' to .encode()/.decode() (#6633) 2019-05-01 07:49:16 +02:00
test_permissions.py Dropped test compatibility shims for Django <2.2. (#7523) 2020-09-07 20:00:17 +02:00
test_prefetch_related.py Remove Django 1.8 & 1.9 compatibility code (#5481) 2017-10-05 20:41:38 +02:00
test_relations_hyperlink.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_relations_pk.py Fix pk-only optimization for properties (#7142) 2020-09-03 11:49:15 +01:00
test_relations_slug.py fix wrong assert 2017-01-21 02:25:36 +06:00
test_relations.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_renderers.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_request.py Fix RemovedInDjango40Warning for middleware get_resopnse() (#7513) 2020-10-09 10:48:03 +01:00
test_requests_client.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_response.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_reverse.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_routers.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_serializer_bulk_update.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_serializer_lists.py Allow type checkers to make serializers generic (#7385) 2020-07-07 10:05:36 +01:00
test_serializer_nested.py Fix tests crash on SQLite without JSON1 extension. (#7409) 2020-07-12 11:08:40 +02:00
test_serializer.py Allow type checkers to make serializers generic (#7385) 2020-07-07 10:05:36 +01:00
test_settings.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_status.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_templates.py made Browsable API base template cachable: omit CSRF token when unnecessary (#7717) 2021-03-16 13:25:21 +00:00
test_templatetags.py Update test_templatetags.py 2020-09-30 09:10:36 +01:00
test_testing.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_throttling.py Handle 'None' return value of wait() properly during throttling. (#6837) 2019-08-12 11:36:05 -07:00
test_urlpatterns.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_utils.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_validation_error.py Handle tuples same as lists in ValidationError detail context (#7647) 2021-01-06 13:13:34 +00:00
test_validation.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_validators.py Fix ModelSerializer unique_together handling for field sources (#7143) 2020-05-13 11:11:26 +01:00
test_versioning.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_views.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_viewsets.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_write_only_fields.py tests: remove some dead code, use assert 0 for never called methods (#5973) 2018-05-08 13:28:46 +01:00
urls.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
utils.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00