summaryrefslogtreecommitdiff
path: root/django/middleware/common.py
diff options
context:
space:
mode:
authorRonan LE HAY <ronan@le-hay.fr>2025-08-31 14:07:52 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-09-03 22:49:34 +0200
commite197953f11a7726746bd7c80664cc38d5ea85588 (patch)
tree0a1439975fcc1e6f6172d2df06865c8b74abcc2d /django/middleware/common.py
parentd82f25d3f0f4eb7be721a72d0e79a8d13d394d32 (diff)
Refs #34989 -- Ensured the Content-Length header is set when redirect with APPEND_SLASH.
Diffstat (limited to 'django/middleware/common.py')
-rw-r--r--django/middleware/common.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/middleware/common.py b/django/middleware/common.py
index bf22d00f01..870d462e6d 100644
--- a/django/middleware/common.py
+++ b/django/middleware/common.py
@@ -105,7 +105,9 @@ class CommonMiddleware(MiddlewareMixin):
# If the given URL is "Not Found", then check if we should redirect to
# a path with a slash appended.
if response.status_code == 404 and self.should_redirect_with_slash(request):
- return self.response_redirect_class(self.get_full_path_with_slash(request))
+ response = self.response_redirect_class(
+ self.get_full_path_with_slash(request)
+ )
# Add the Content-Length header to non-streaming responses if not
# already set.