From 0ed8d4e7d1029e1283b04f70d51d2af96ad85d6a Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Mon, 12 Jan 2026 14:51:32 +0100 Subject: Fixed #36859 -- Made assertContains and assertNotContains idempotent for streaming responses. --- django/test/testcases.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'django/test/testcases.py') 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 -- cgit v1.3