Skip to content

_make_vcr_request doesn't support async streams #941

@jamesbraza

Description

@jamesbraza

I am using hishel for HTTP caching. hishel can inject an httpx.AsyncByteStream.

This leads to a failure with VCR.py where:

  1. In stubs/httpx_stubs.py, _async_vcr_send calls _shared_vcr_send: https://github.com/kevin1024/vcrpy/blob/v7.0.0/vcr/stubs/httpx_stubs.py#L149-L150
  2. _shared_vcr_send calls _make_vcr_request, which does a sync read: https://github.com/kevin1024/vcrpy/blob/v7.0.0/vcr/stubs/httpx_stubs.py#L108
  3. The sync read will then throw an AssertionError due to not being a sync Iterable: https://github.com/encode/httpx/blob/0.28.1/httpx/_models.py#L473

Basically the request is, can VCR.py not use a sync read from within _async_vcr_send as it's not always compatible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions