cloudflare / cloudflare/workers-rs

[Feature] ObjectBody needs a response_body equivalent when using the http feature

Open
#687 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
3.7k
Forks
429
Avg merge
20h 28m
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Description

Currently [ObjectBody.responseBody()](https://docs.rs/worker/0.5.0/worker/struct.ObjectBody.html#method.response_body) is a more CPU efficient way to stream the body of an R2 object, but it uses the "legacy?" ResponseBody structure and no alternative exist for when the `http` feature is enabled that uses `http-body` traits.

Maybe exposing a `ReadableStream` from `ObjectBody` with some kind of `into_inner()` that can be used with [worker::Body::new()](https://docs.rs/worker/0.5.0/worker/struct.Body.html#method.new) constructor could be the new API.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.