Skip to content

Commit

Permalink
Merge pull request #2535 from PankajKhanwani/added_response.ok_to_Fas…
Browse files Browse the repository at this point in the history
…tResponse_class

Added response.ok support to FastHttpUser's FastResponse class simila…
  • Loading branch information
cyberw authored Jan 6, 2024
2 parents 1ff08df + b62b436 commit fe47974
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions locust/contrib/fasthttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ def status_code(self) -> int:
"""
return self._response.get_code() if self._response is not None else 0

@property
def ok(self):
"""Returns True if :attr:`status_code` is less than 400, False if not."""
return self.status_code < 400

def _content(self):
if self.headers is None:
return None
Expand Down

0 comments on commit fe47974

Please sign in to comment.