Skip to content

Commit

Permalink
Responses are now text by default, even if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Nov 15, 2023
1 parent 67a14c2 commit 4a6002b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions minet/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class Response(object):
__text: Optional[str]
__url: str
__datetime_utc: datetime
__is_text: Optional[bool]
__is_text: bool
__encoding: Optional[str]
__ext: Optional[str]
__mimetype: Optional[str]
Expand All @@ -712,7 +712,7 @@ def __init__(
self.__body = body
self.__text = None
self.__datetime_utc = datetime.utcnow()
self.__is_text = None
self.__is_text = True
self.__encoding = known_encoding
self.__ext = None
self.__mimetype = None
Expand Down Expand Up @@ -783,8 +783,6 @@ def __decode(self, errors: str = "replace") -> None:
self.__guess_extension()
self.__guess_encoding()

assert self.__is_text is not None

if not self.__is_text:
raise TypeError("response is binary and cannot be decoded")

Expand Down

0 comments on commit 4a6002b

Please sign in to comment.