Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added response.ok support to FastHttpUser's FastResponse class similar to HttpUser's Response #2535

Conversation

PankajKhanwani
Copy link
Contributor

@PankajKhanwani PankajKhanwani commented Jan 6, 2024

No description provided.

@cyberw cyberw merged commit fe47974 into locustio:master Jan 6, 2024
15 checks passed
@cyberw
Copy link
Collaborator

cyberw commented Jan 6, 2024

Nice!

@cyberw cyberw changed the title Added response.ok support to FastHttpUser's FastResponse class simila… Added response.ok support to FastHttpUser's FastResponse class similar to HttpUser's Response Jan 6, 2024
@PankajKhanwani PankajKhanwani deleted the added_response.ok_to_FastResponse_class branch January 6, 2024 16:26
@cyberw
Copy link
Collaborator

cyberw commented Jan 6, 2024

Huh. Seems this only fixes it for "direct" calls, not for ResponseContextManager. So the following doesnt work for FastHttpUser. Can you take a look?

with self.client.get("/", catch_response=True) as resp:
    print(resp.ok)

@PankajKhanwani
Copy link
Contributor Author

PankajKhanwani commented Jan 7, 2024

IDK but for me it is working. Maybe I need to update the tag so that latest installation of locust include this as well

class FastTestUser(FastHttpUser):
host = "https://example.com"

  @task
  def get(self):
      with self.client.get("/", catch_response=True) as resp:
          print(resp.__class__)
          print(resp.ok)

Output:
<class 'locust.contrib.fasthttp.ResponseContextManager'> True

@cyberw
Copy link
Collaborator

cyberw commented Jan 7, 2024

Sorry, my bad. I must have accidentally been on a branch or something.. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants