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

Add iter_lines Method to FastHttpSession Class #3024

Merged
merged 32 commits into from
Feb 8, 2025

Conversation

MasterKey-Pro
Copy link
Contributor

@MasterKey-Pro MasterKey-Pro commented Jan 8, 2025

1、Add iter_lines Method to FastHttpSession Class
2、fix: Remove trailing whitespace from blank line in fasthttp.py to comply with PEP 8

Fixes #3018

MasterKey-Pro and others added 5 commits January 6, 2025 09:15
在 FastHttpSession 类中添加 iter_lines 方法
Reuses the logic of the request method and provides type annotations to enhance code readability and consistency.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: Remove trailing whitespace from blank line in fasthttp.py to comply with PEP 8
fix: fasthttp.py to comply with PEP 8
@cyberw
Copy link
Collaborator

cyberw commented Jan 8, 2025

Looks good, but can you add a test case too? (in test_fasthttp.py)

@MasterKey-Pro MasterKey-Pro reopened this Jan 9, 2025
@MasterKey-Pro
Copy link
Contributor Author

The lack of an endpoint that can return streaming data or a simulated response might be the reason for the test failure.

@cyberw
Copy link
Collaborator

cyberw commented Jan 9, 2025

Can you use the /streaming/:int: endpoint defined here?

@app.route("/streaming/<int:iterations>")

@MasterKey-Pro
Copy link
Contributor Author

您可以使用此处定义的 /streaming/:int: 端点吗?

@app.route("/streaming/<int:iterations>")

I have just completed the implementation of the iter_lines method in FastHttpSession and successfully passed all related tests. I look forward to your review and feedback on this part of the work.

@cyberw
Copy link
Collaborator

cyberw commented Jan 26, 2025

Looks nice! (sorry for the lack of activity)

Does it make sense to have a parameter for method? (it can still default to GET)

Can the test also ensure that a the request is logged? You can look at the other tests for examples.

@cyberw
Copy link
Collaborator

cyberw commented Feb 7, 2025

Ping @MasterKey-Pro :)

MasterKey-Pro and others added 6 commits February 8, 2025 14:01
… method (default is still GET). 2. Used assert_called_once_with to ensure the request method is called with the correct parameters. 3. Added a logging feature and used assertLogs to check if the request information is logged.
… method (default is still GET). 2. Used assert_called_once_with to ensure the request method is called with the correct parameters. 3. Added a logging feature and used assertLogs to check if the request information is logged.
@MasterKey-Pro
Copy link
Contributor Author

@cyberw Hello, apologies for the delay in responding as I was on an extended vacation. Regarding the changes, the main updates are as follows:

Added a method parameter to allow the caller to customize the HTTP method (default is still GET);
Used assert_called_once_with to ensure the request method is called with the correct parameters;
Removed the logging check since the focus was on verifying the correct HTTP method, which was handled using assert_called_once_with.

@cyberw cyberw merged commit 41f2863 into locustio:master Feb 8, 2025
17 checks passed
@cyberw
Copy link
Collaborator

cyberw commented Feb 8, 2025

Awesome! I'll make sure it gets visible in the documentation too.

@MasterKey-Pro
Copy link
Contributor Author

@cyberw I've always wanted to express my gratitude, and I'm glad I finally have the chance. It’s an honor to be part of this, which has brought me great involvement and a sense of accomplishment. Thank you and the team for your hard work. Locust has helped me grow my skills in the competitive job market, while also creating a better future for me and my family. Your dedication to maintaining Locust has impacted many professionals, giving us more opportunities and hope. I wish you and the team continued success, and for Locust to keep growing

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.

Suggestion to Add "iter_lines" Support for "FastHttpUser" in Locust
2 participants