summaryrefslogtreecommitdiff
path: root/django/test/testcases.py
diff options
context:
space:
mode:
authorBaptiste Mispelon <baptiste.mispelon@torchbox.com>2026-01-12 14:51:32 +0100
committernessita <124304+nessita@users.noreply.github.com>2026-03-16 17:44:40 -0300
commit0ed8d4e7d1029e1283b04f70d51d2af96ad85d6a (patch)
treeed05472acc2f4cf13e4539d15f851ce139ff3e01 /django/test/testcases.py
parent4b2edb3418851c09dd839f1a2cba74051fe9d420 (diff)
Fixed #36859 -- Made assertContains and assertNotContains idempotent for streaming responses.
Diffstat (limited to 'django/test/testcases.py')
-rw-r--r--django/test/testcases.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 5f83612fe5..de2a3eb61d 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -575,6 +575,8 @@ class SimpleTestCase(unittest.TestCase):
if response.streaming:
content = b"".join(response.streaming_content)
+ # Reset the content so it can be checked again (idempotency).
+ response.streaming_content = [content]
else:
content = response.content
response_content = content