seed-rs / seed

A Rust framework for creating web apps
MIT License
3.81k stars 155 forks source link

fix(fetch): changed Request.body to take its argument by reference #606

Closed glennsl closed 3 years ago

glennsl commented 3 years ago

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.