-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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: prefer pages over endpoints when prerendering #12998
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 7ab5f97 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
preview: https://svelte-dev-git-preview-kit-12998-svelte.vercel.app/ this is an automated message |
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.
Is a test still TODO or is it basically impossable to test?
const response = await server.respond( | ||
new Request(config.prerender.origin + encoded, { | ||
headers: { | ||
accept: 'text/html,*/*' |
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.
Should we add a comment here explaining why we do this?
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'll add a comment (although, I'm not quite sure how to best phrase it)
Is this the right fix? Feels like maybe 405 is the wrong response for a |
I chose not to add a test because it's only reproducible by breaking the prerender app build. But I could add a test that just sends a request to the route and see if we get a 405.
An alternative is to await the
|
related to content negotiation #11794 |
fixes #10735
This PR adds an
Accept
header to the prerender requests, preferringtext/html
first then whatever with*/*
. Previously, it would always end up as*/*
during content negotiation, which invokes the endpoint handler, causing a405 method not allowed
if the GET handler doesn't exist.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
No test because it would break the prerender app build.
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits