Fix: support FormData object on fetch body#3417
Merged
bholmesdev merged 5 commits intomainfrom May 20, 2022
Merged
Conversation
🦋 Changeset detectedLatest commit: 3174bde The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
natemoo-re
approved these changes
May 20, 2022
Member
natemoo-re
left a comment
There was a problem hiding this comment.
LGTM! I would change the changeset to minor for webapi though.
Merged
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.
Changes
node-fetchto external dependency for@astrojs/webapibundle. This was causing strange issues with body parsing that I still haven't figured out. Still, since@astrojs/telemetryalready pulls innode-fetchas a standard dependency, this shouldn't be a problem!node-fetch/src/index.jsexposed type issues. A few pieces to resolve:fetchno longer acceptsURLas a resource type. Funny enough, you can still pass aURLfor node-fetch to runtoString()implicitly. Still, you get red squigglies in VS Code using URL today, so removing this type option is for consistency if anything.FetchInitnow uses node-fetch's body type in its type signatureWhy not switch to undici like all the cool kids?
@FredKSchott (a cool kid) suggested using undici since it mirrors Node's incoming fetch standard. This seemed possible at first... until I discovered their node versioning requirements. In short: they don't expose
fetchorRequestfor node versions below 16.5. Also poked the source code to confirm. This would mean dropping Node 14.X support, which feels a bit too far as we approach 1.0. Keep it in mind for the future though!Testing
N/A
Docs
N/A