-
Notifications
You must be signed in to change notification settings - Fork 79
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(fetch): respect Request
properties
#688
base: main
Are you sure you want to change the base?
fix(fetch): respect Request
properties
#688
Conversation
🦋 Changeset detectedLatest commit: 5c11df4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
*/ | ||
export async function fetch(info, init) { | ||
init = addDuplexToInit(init) | ||
if (info instanceof Request) { | ||
init.method ??= info.method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how far long this PR is, so the comment may be premature, but two thoughts:
- why are only these particular properties of
Request
are copied over. It has other many other properties which are also valid to be set via the second argument tofetch
. E.g.mode
,cache
, and others. - I am not sure how this fixes Cloning a Request in edge runtime when running the dev server does not work correctly next.js#57905. That issue is about the
Request
constructor not working properly when the first argument to it is aRequest
instance -fetch
is not involved at all, though it is in some ways similar.
Fixes vercel/next.js#41531, Fixes vercel/next.js#57905