Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading Fetch response bodies as streams #919

Closed
johanbrandhorst opened this issue Feb 3, 2020 · 1 comment
Closed

Support reading Fetch response bodies as streams #919

johanbrandhorst opened this issue Feb 3, 2020 · 1 comment
Labels
feature-request A feature request

Comments

@johanbrandhorst
Copy link

johanbrandhorst commented Feb 3, 2020

Is your feature request related to a problem? Please describe.
When making web requests to servers, the returned data is sometimes streamed so that early results can be used immediately, instead of waiting for the whole request to finish. It also allows the use of never-ending streams which continuously stream data (as an alternative to websockets).

Describe the solution you'd like
The yew response body should contain a way to stream the data from the Fetch response body type.

The type returned from fetch: https://developer.mozilla.org/en-US/docs/Web/API/Response. The type of Response.body: https://developer.mozilla.org/en-US/docs/Web/API/Body/body.

More information
This is where we discard the stream today:

(std_web):

var promise = (@{binary}) ? response.arrayBuffer() : response.text();

(web_sys):

let data_promise = if self.binary {
response.array_buffer()
} else {
response.text()
}

@johanbrandhorst johanbrandhorst added the feature-request A feature request label Feb 3, 2020
@mc1098
Copy link
Contributor

mc1098 commented Jul 29, 2021

I think this can now be closed as the fetch service has been removed in #1842

@siku2 siku2 closed this as completed Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature request
Projects
None yet
Development

No branches or pull requests

3 participants