lipanski / mockito

HTTP mocking for Rust!
MIT License
695 stars 59 forks source link

with_chunked_body does not support backpressure #175

Closed kornelski closed 1 year ago

kornelski commented 1 year ago

Currently with_chunked_body writes the entire body to a buffer.

This makes it impossible to test how servers stream the body: I don't control timing between chunks. I can't make an infinitely-long stream to test when the server will refuse to read it.

IMHO the chunked stream should spawn the callback on a thread, and use tokio's channel to send bytes to the body, as they're written.

lipanski commented 1 year ago

@kornelski I agree. I think this regression was introduced with the tokio rewrite. not sure when I'll be able to tackle this but PRs are welcome as always :smile_cat: