From 9aa56cb0d5dede7fc176a46c745dfd3dacdad773 Mon Sep 17 00:00:00 2001 From: sage Date: Wed, 27 Mar 2019 11:40:10 +0700 Subject: Fixed #30294 -- Allowed HttpResponse to accept memoryview content. --- django/http/response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django') 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)) -- cgit v1.3