summaryrefslogtreecommitdiff
path: root/tests/httpwrappers
diff options
context:
space:
mode:
authorsage <laymonage@gmail.com>2019-03-27 11:40:10 +0700
committerTim Graham <timograham@gmail.com>2019-03-29 09:43:49 -0400
commit9aa56cb0d5dede7fc176a46c745dfd3dacdad773 (patch)
tree4dfd4aed31297ccaf8b0b03e1db56cfd0e980af6 /tests/httpwrappers
parent879cc3da6249e920b8d54518a0ae06de835d7373 (diff)
downloaddjango-9aa56cb0d5dede7fc176a46c745dfd3dacdad773.tar.gz
Fixed #30294 -- Allowed HttpResponse to accept memoryview content.
Diffstat (limited to 'tests/httpwrappers')
-rw-r--r--tests/httpwrappers/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index e6c6297898..0c81cd0341 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -366,6 +366,10 @@ class HttpResponseTests(unittest.TestCase):
r.content = 12345
self.assertEqual(r.content, b'12345')
+ def test_memoryview_content(self):
+ r = HttpResponse(memoryview(b'memoryview'))
+ self.assertEqual(r.content, b'memoryview')
+
def test_iter_content(self):
r = HttpResponse(['abc', 'def', 'ghi'])
self.assertEqual(r.content, b'abcdefghi')