fix(fetch): allow third-party FormData/Blob bodies#1643
Merged
mcollina merged 1 commit intonodejs:mainfrom Sep 11, 2022
Merged
Conversation
`webidl.converters.XMLHttpRequestBodyInit` rejected third-party `FormData`/`Blob`s, meaning they were passed through `webidl.converters.DOMString`. This meant `Request`/`Response`s constructed with third-party `FormData`/`Blob` bodies ended up with a plain-text `[object FormData]`/`[object Blob]` body.
Codecov Report
@@ Coverage Diff @@
## main #1643 +/- ##
=======================================
Coverage 94.60% 94.60%
=======================================
Files 53 53
Lines 4803 4803
=======================================
Hits 4544 4544
Misses 259 259
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
ronag
approved these changes
Sep 11, 2022
mrbbot
added a commit
to cloudflare/miniflare
that referenced
this pull request
Dec 23, 2022
`5.11.0` includes nodejs/undici#1643. There are some non-trivial changes required to upgrade to `5.14.0`: - Since `[email protected]` (nodejs/undici#1697), `structuredClone` is used on bodies, which may be byte streams. Due to a Node bug (nodejs/node#45955), readable byte streams cannot be transferred, breaking `fetch`. - Since `[email protected]` (nodejs/undici#1793), global `ReadableStream` and `TransformStream` are used if available. In the Vitest environment, (which modifies the global scope unlike Jest which runs tests in a VM context), if the `streams_enable_constructors` compatibility flag isn't enabled, `fetch` breaks as `ReadableStream`s can't be constructed.
metcoder95
pushed a commit
to metcoder95/undici
that referenced
this pull request
Dec 26, 2022
crysmags
pushed a commit
to crysmags/undici
that referenced
this pull request
Feb 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
webidl.converters.XMLHttpRequestBodyInitrejected third-partyFormData/Blobs, meaning they were passed throughwebidl.converters.DOMString. This meantRequest/Responses constructed with third-partyFormData/Blobbodies ended up with a plain-text[object FormData]/[object Blob]body.Undici has code for extracting a body from third-party
Blobs andFormDatas. This was just being called after Web IDL conversion.