Skip to content

Read mode/credentials from init object, not request - #7453

Merged
Rich-Harris merged 3 commits into
masterfrom
gh-6739
Oct 31, 2022
Merged

Read mode/credentials from init object, not request#7453
Rich-Harris merged 3 commits into
masterfrom
gh-6739

Conversation

@Rich-Harris

Copy link
Copy Markdown
Member

This is an alternative to #7192. Rather than checking for a cf property, it reads mode and credentials from the second argument passed to fetch, unless fetch was called with a Request object (which is a somewhat unusual case; code that does fetch(request) would have to be refactored to fetch(url, init) on Cloudflare).

I'm slightly ambivalent about which approach is better. This gets rid of the Cloudflare-specific cf stuff, and in theory is more resilient to other runtimes doing the same thing, but it would force the aforementioned refactoring in a very small minority of cases.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot

changeset-bot Bot commented Oct 31, 2022

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 06a5cf6

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit 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

@dummdidumm dummdidumm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we go with this first and then see how often it comes up afterwards? We can always add the other PR on top/instead later on.

@Rich-Harris
Rich-Harris merged commit 9f57ff3 into master Oct 31, 2022
@Rich-Harris
Rich-Harris deleted the gh-6739 branch October 31, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants