Document that api_catch_all disables APPEND_SLASH behavior for the api

See #188
This commit is contained in:
Klaas van Schelven
2025-08-25 08:36:49 +02:00
parent f0d3667121
commit cff82b4797

View File

@@ -209,6 +209,13 @@ def download_file(request, checksum):
@csrf_exempt
def api_catch_all(request, subpath):
# This is a catch-all for unimplemented API endpoints. It logs the request details and raises a 404 (if
# API_LOG_UNIMPLEMENTED_CALLS is set).
# the existance of this view (and the associated URL pattern) has the effect of `APPEND_SLASH=False` for our API
# endpoints, which is a good thing: for API enpoints you generally don't want this kind of magic (explicit breakage
# is desirable for APIs, and redirects don't even work for POST/PUT data)
if not get_settings().API_LOG_UNIMPLEMENTED_CALLS:
raise Http404("Unimplemented API endpoint: /api/" + subpath)