Skip to content

Conversation

@MasterKey-Pro
Copy link
Contributor

@MasterKey-Pro MasterKey-Pro commented Dec 12, 2025

Fixes #3018

from locust import FastHttpUser, task


class MyUser(FastHttpUser):
    @task
    def test_streaming(self):
        for line in self.client.iter_lines(
            "/api/stream",
            method="POST",
            json={"query": "Hello"},
            headers={"Accept": "text/event-stream"}
        ):
            print(f"Received: {line}")

@cyberw
Copy link
Collaborator

cyberw commented Dec 12, 2025

Niice. Fix the formatting (ruff) and I'll merge it!

@cyberw cyberw merged commit c4fb614 into locustio:master Dec 12, 2025
17 of 18 checks passed
@cyberw
Copy link
Collaborator

cyberw commented Dec 12, 2025

Thx!

@MasterKey-Pro
Copy link
Contributor Author

谢谢!

I check the version status of Locust every day, but I didn't notice this issue since it was listed further down. By chance, I just felt it looked familiar, and upon opening it, I realized it was indeed related to my previous work.😭

MasterKey-Pro added a commit to MasterKey-Pro/locust that referenced this pull request Dec 12, 2025
Merge pull request locustio#3311 from MasterKey-Pro/master
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