REQUEST with unknown and undetectable encoding (#600)

This commit is contained in:
John Cant
2023-08-02 21:49:37 +01:00
committed by GitHub
parent 5119ce92cb
commit 57380190bc
2 changed files with 9 additions and 2 deletions

View File

@@ -740,12 +740,12 @@ class Response(object):
"""
Similar to the Response class from the `requests` library.
"""
def __init__(self, content, status, statusText, headers, encoding):
def __init__(self, content, status, statusText, headers, encoding=None):
self.content = content # raw bytes
self.status_code = status # e.g. 404
self.reason = statusText # e.g. "Not Found"
self.headers = CaseInsensitiveDict(headers)
self.encoding = encoding or self.apparent_encoding
self.encoding = encoding or self.apparent_encoding or "utf-8"
@property
def text(self):