From 4a685bc0dca5298a7d5a4e162120a90cac7fd1a4 Mon Sep 17 00:00:00 2001 From: SaJH Date: Wed, 11 Sep 2024 21:23:23 +0900 Subject: Fixed #35727 -- Added HttpResponse.text property. Signed-off-by: SaJH --- docs/ref/request-response.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 31111a435a..afebd00d8b 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -833,6 +833,13 @@ Attributes A bytestring representing the content, encoded from a string if necessary. +.. attribute:: HttpResponse.text + + .. versionadded:: 5.2 + + A string representation of :attr:`HttpResponse.content`, decoded using the + response's :attr:`HttpResponse.charset` (defaulting to ``UTF-8`` if empty). + .. attribute:: HttpResponse.cookies A :py:obj:`http.cookies.SimpleCookie` object holding the cookies included @@ -1272,6 +1279,9 @@ with the following notable differences: :attr:`~StreamingHttpResponse.streaming_content` attribute. This can be used in middleware to wrap the response iterable, but should not be consumed. +* It has no ``text`` attribute, as it would require iterating the response + object. + * You cannot use the file-like object ``tell()`` or ``write()`` methods. Doing so will raise an exception. -- cgit v1.3