Since RequestInit::body actually takes a &JsValue, we can have Request::body take a reference too, and store it in a Cow internally, which helps with sharing data in interop-heavy code that assumes JS idioms and GC'd values.
This is a breaking change, but a minor one I think. Alternatively we could add a separate body_ref function instead.
Since
RequestInit::body
actually takes a&JsValue
, we can haveRequest::body
take a reference too, and store it in aCow
internally, which helps with sharing data in interop-heavy code that assumes JS idioms and GC'd values.This is a breaking change, but a minor one I think. Alternatively we could add a separate
body_ref
function instead.