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

fix(Body.body): Normalize Body.body into a node:stream #924

merged 14 commits into from Sep 14, 2021


Copy link

@jimmywarting jimmywarting commented Sep 4, 2020


Normalize Body.body into a stream to be more in line with spec.
and also to simplify other parts so we deal with less underlying types of bodies


Constructing a Response or Request with a string, blob or anything else gets converted into a node:stream now

Previously, what you passed into the Response or Request as a body would in the end be the same thing in Body.body (new Response('abc').body === 'abc' ). This is wrong.

  • I updated ./docs/ with a link to this PR or Issue
  • I added unit test(s)


Right now it's converted into a node:stream but i'm thinking it can be converted to a whatwg:stream in v4
it would be suppressing to me if someone rely on Response.body being whatever was passed to the Response constructor, not necessarily a stream. so perhaps this can slip in as a non major change?

I also lowercased the nodefetchformdataboundary cuz one issue is that Blob's type is casted to lowercase also

@jimmywarting jimmywarting changed the title Body conversion fix(Body.body): Normalize Body.body into a stream Sep 13, 2021
@jimmywarting jimmywarting mentioned this pull request Sep 13, 2021
4 tasks
@jimmywarting jimmywarting changed the title fix(Body.body): Normalize Body.body into a stream fix(Body.body): Normalize Body.body into a node:stream Sep 13, 2021
gr2m approved these changes Sep 13, 2021
LinusU approved these changes Sep 14, 2021
Copy link

@LinusU LinusU left a comment

Neat! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

4 participants