Skip to content

Conversation

@chessbyte
Copy link
Contributor

Issue # (if available)

Closes #946

Description of changes

Implements Response.body and Request.body as ReadableStream per WHATWG Fetch spec:

  • Response.body returns ReadableStream for streaming response data
  • Request.body returns ReadableStream for request bodies
  • Byte stream controller (type: "bytes") with BYOB reader support
  • Response.clone() uses tee() to allow cloning after body access
  • fetch() accepts ReadableStream as request body for streaming uploads
  • Compressed responses (gzip/deflate/brotli) stream decompressed data
  • pipeTo() support for piping body streams to WritableStream

Added 42 new tests covering fetch body stream functionality.

Checklist

  • Created unit tests in tests/unit and/or in Rust for my feature if needed
  • Ran make fix to format JS and apply Clippy auto fixes
  • Made sure my code didn't add any additional warnings: make check
  • Added relevant type info in types/ directory
  • Updated documentation if needed (API.md/README.md/Other)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@chessbyte chessbyte force-pushed the feat/fetch-body-streams branch from df4b51c to 0989d8f Compare December 6, 2025 21:19
@Sytten
Copy link
Collaborator

Sytten commented Dec 7, 2025

Yess!! You are shipping fast, we will try to review all pending PR.
Is the fetch spec using web streams?

@nabetti1720
Copy link
Contributor

Is the fetch spec using web streams?

At least, it uses llrt_stream_web instead of llrt_stream, so that doesn't seem to be a problem.
Anyway, the work is fast! I'm looking forward to running the WPT once this PR is merged. :)

@chessbyte
Copy link
Contributor Author

@Sytten @nabetti1720 thanks for the compliment. I was hoping that this project would reach 1.0 status by re:Invent, but that did not happen. Instead of idly waiting, I decided to help push the project forward.

@chessbyte chessbyte mentioned this pull request Dec 7, 2025
@chessbyte chessbyte force-pushed the feat/fetch-body-streams branch 2 times, most recently from 13a141e to 6fe1e60 Compare December 8, 2025 19:04
Closes awslabs#946

Implements Response.body and Request.body as ReadableStream per WHATWG Fetch spec:

- Response.body returns ReadableStream<Uint8Array> for streaming response data
- Request.body returns ReadableStream<Uint8Array> for request bodies
- Byte stream controller (type: "bytes") with BYOB reader support
- Response.clone() uses tee() to allow cloning after body access
- fetch() accepts ReadableStream as request body for streaming uploads
- Compressed responses (gzip/deflate/brotli) stream decompressed data
- pipeTo() support for piping body streams to WritableStream

Added 42 new tests covering fetch body stream functionality.
@chessbyte chessbyte force-pushed the feat/fetch-body-streams branch from 6fe1e60 to 6a6a1c9 Compare December 13, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetch does not support webstreams

3 participants