Skip to content

Consider adding a MockStream #156

@lundberg

Description

@lundberg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions