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

Consider adding a MockStream #156

Open
lundberg opened this issue Jul 8, 2021 · 0 comments
Open

Consider adding a MockStream #156

lundberg opened this issue Jul 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@lundberg
Copy link
Owner

lundberg commented Jul 8, 2021

It might be of use if RESPX had a MockStream utility that could be passed as stream when creating a httpx.Response.

The MockStream should suport both sync and async contexts.

Ideas...

stream = MockStream(json={})
stream = MockStream(text="hello")

Also, mocking a response stream with content from local file would be of interest in some cases, e.g. large test responses. It should probably take either a file-path string or a file-like object.

stream = MockStream(file=...)

Other things to consider is form data and multipart responses.

@lundberg lundberg mentioned this issue Sep 17, 2021
6 tasks
@lundberg lundberg added the enhancement New feature or request label Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant