Skip to content

Commit

Permalink
Fixed response failure for unsupported encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
princemelvin@microsoft.com committed Dec 11, 2023
1 parent 247fee9 commit ea7751a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions locust/contrib/fasthttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def rest(
with self.client.request(method, url, catch_response=True, headers=headers, **kwargs) as r:
resp = cast(RestResponseContextManager, r)
resp.js = None # type: ignore
if resp.text is None:
if resp.content is None:
resp.failure(str(resp.error))
elif resp.text:
try:
Expand Down Expand Up @@ -467,8 +467,8 @@ def text(self) -> Optional[str]:
# No information, try to detect
if not self.encoding:
self.encoding = str(detect(self.content)["encoding"])

return str(self.content, self.encoding, errors="replace")
if self.encoding != "None":
return str(self.content, self.encoding, errors="replace")

@property
def url(self) -> Optional[str]:
Expand Down

0 comments on commit ea7751a

Please sign in to comment.