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

[wasm] BrowserHttpHandler to support large/streaming requests via ReadableStream #64333

Closed
pavelsavara opened this issue Jan 26, 2022 · 2 comments
Labels
arch-wasm WebAssembly architecture area-System.Net.Http
Milestone

Comments

@pavelsavara
Copy link
Member

Currently PostAsync_CancelDuringRequestContentSend_TaskCanceledQuickly test fails with OutOfMemoryException

We should instead allow streaming requests

const stream = new ReadableStream({
  async start(controller) {
    await wait(1000);
    controller.enqueue('This ');
    await wait(1000);
    controller.enqueue('is ');
    await wait(1000);
    controller.enqueue('a ');
    await wait(1000);
    controller.enqueue('slow ');
    await wait(1000);
    controller.enqueue('request.');
    controller.close();
  },
}).pipeThrough(new TextEncoderStream());

fetch(url, {
  method: 'POST',
  headers: { 'Content-Type': 'text/plain' },
  body: stream,
});

See https://web.dev/fetch-upload-streaming/

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-System.Net.Http labels Jan 26, 2022
@pavelsavara pavelsavara added this to the 7.0.0 milestone Jan 26, 2022
@ghost
Copy link

ghost commented Jan 26, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Currently PostAsync_CancelDuringRequestContentSend_TaskCanceledQuickly test fails with OutOfMemoryException

We should instead allow streaming requests

const stream = new ReadableStream({
  async start(controller) {
    await wait(1000);
    controller.enqueue('This ');
    await wait(1000);
    controller.enqueue('is ');
    await wait(1000);
    controller.enqueue('a ');
    await wait(1000);
    controller.enqueue('slow ');
    await wait(1000);
    controller.enqueue('request.');
    controller.close();
  },
}).pipeThrough(new TextEncoderStream());

fetch(url, {
  method: 'POST',
  headers: { 'Content-Type': 'text/plain' },
  body: stream,
});

See https://web.dev/fetch-upload-streaming/

Author: pavelsavara
Assignees: -
Labels:

arch-wasm, area-System.Net.Http

Milestone: 7.0.0

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jan 26, 2022
@campersau
Copy link
Contributor

Might be a duplicate of #36634 ?

@ghost ghost locked as resolved and limited conversation to collaborators Feb 26, 2022
@karelz karelz removed the untriaged New issue has not been triaged by the area owner label Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Net.Http
Projects
None yet
Development

No branches or pull requests

3 participants