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(fetch): respect Request properties #688

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Nov 2, 2023

Copy link

changeset-bot bot commented Nov 2, 2023

🦋 Changeset detected

Latest commit: 5c11df4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@edge-runtime/primitives Patch
@edge-runtime/types Patch
@edge-runtime/vm Patch
@edge-runtime/jest-environment Patch
edge-runtime Patch

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

Copy link

vercel bot commented Nov 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
edge-runtime ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2023 1:04pm

*/
export async function fetch(info, init) {
init = addDuplexToInit(init)
if (info instanceof Request) {
init.method ??= info.method
Copy link

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:

  1. 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 to fetch. E.g. mode, cache, and others.
  2. 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 a Request instance - fetch is not involved at all, though it is in some ways similar.

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