1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #34742 -- Made CommonMiddleware raise APPEND_SLASH RuntimeError on DELETE requests.

This commit is contained in:
Avaneesh Kumar
2023-12-07 02:54:52 -06:00
committed by Mariusz Felisiak
parent 5b3b791e90
commit 705b1702bd
2 changed files with 8 additions and 5 deletions

View File

@@ -78,12 +78,12 @@ class CommonMiddleware(MiddlewareMixin):
Return the full path of the request with a trailing slash appended.
Raise a RuntimeError if settings.DEBUG is True and request.method is
POST, PUT, or PATCH.
DELETE, POST, PUT, or PATCH.
"""
new_path = request.get_full_path(force_append_slash=True)
# Prevent construction of scheme relative urls.
new_path = escape_leading_slashes(new_path)
if settings.DEBUG and request.method in ("POST", "PUT", "PATCH"):
if settings.DEBUG and request.method in ("DELETE", "POST", "PUT", "PATCH"):
raise RuntimeError(
"You called this URL via %(method)s, but the URL doesn't end "
"in a slash and you have APPEND_SLASH set. Django can't "