Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
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

Enhancement: Provide test client that can handle infinite SSE generators #3654

Open
aranvir opened this issue Aug 3, 2024 · 0 comments · May be fixed by #3655
Open

Enhancement: Provide test client that can handle infinite SSE generators #3654

aranvir opened this issue Aug 3, 2024 · 0 comments · May be fixed by #3655
Labels
Enhancement This is a new feature or request

Comments

@aranvir
Copy link
Contributor

aranvir commented Aug 3, 2024

Summary

Follow-up from https://github.com/orgs/litestar-org/discussions/3547

The litestart test clients directly call the ASGI app instance. When calling stream endpoints like SSEs, they will always try to consume the whole stream. If the endpoint serves an infinite generator, the test client is stuck. This does not happen for the test client websocket implementation is because it "cheats" by not implementing the actual websocket protocol but using an internal queue to transport the messages.

The solution for this edge case is to run the app in a subprocess (e.g. via uvicorn) and then use an httpx client to connect to the web app.

Basic Example

No response

Drawbacks and Impact

No response

Unresolved questions

No response


Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@aranvir aranvir added the Enhancement This is a new feature or request label Aug 3, 2024
@aranvir aranvir linked a pull request Aug 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement This is a new feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant