You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's nice that http-types compiles to WASM in the browser, even nicer would be to have a way to convert back and forth between the Request/Response types in this crate and the "native" JS Request/Response to avoid wrapping with a new type. The feature can be gated with a flag(e.g. web).
This is probably better and more general purpose than what I proposed in http-rs/http-client#60 and can eventually simplify the code over there. I also think conversion could be made more efficient if the JS Request/Response body that is a ReadableStream(implements the asyncIterator protocol) is converted to a Stream/AsyncReader, modern Chrome even allows transferring those streams with the postMessage API so for my use case of intercepting requests from a ServiceWorker to be handled in a Worker(Using Rust and http-types) could be made much more efficient in the future.
The text was updated successfully, but these errors were encountered:
olanod
changed the title
Convert from/into web_sys::Request
Convert from/into web_sys::Request/Response
Dec 30, 2020
It's nice that
http-types
compiles to WASM in the browser, even nicer would be to have a way to convert back and forth between the Request/Response types in this crate and the "native" JS Request/Response to avoid wrapping with a new type. The feature can be gated with a flag(e.g.web
).This is probably better and more general purpose than what I proposed in http-rs/http-client#60 and can eventually simplify the code over there. I also think conversion could be made more efficient if the JS Request/Response body that is a
ReadableStream
(implements theasyncIterator
protocol) is converted to a Stream/AsyncReader, modern Chrome even allows transferring those streams with the postMessage API so for my use case of intercepting requests from a ServiceWorker to be handled in a Worker(Using Rust andhttp-types
) could be made much more efficient in the future.The text was updated successfully, but these errors were encountered: