summaryrefslogtreecommitdiff
path: root/django/http
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 /django/http
parent879cc3da6249e920b8d54518a0ae06de835d7373 (diff)
Fixed #30294 -- Allowed HttpResponse to accept memoryview content.
Diffstat (limited to 'django/http')
-rw-r--r--django/http/response.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/http/response.py b/django/http/response.py
index 6a84e193ba..a9ede09dd9 100644
--- a/django/http/response.py
+++ b/django/http/response.py
@@ -229,7 +229,7 @@ class HttpResponseBase:
# Handle string types -- we can't rely on force_bytes here because:
# - Python attempts str conversion first
# - when self._charset != 'utf-8' it re-encodes the content
- if isinstance(value, bytes):
+ if isinstance(value, (bytes, memoryview)):
return bytes(value)
if isinstance(value, str):
return bytes(value.encode(self.charset))