Open eltigerchino opened 1 week ago
Latest commit: 7ab5f9762e5eb0df8cb27acd0bf8bd596f54123e
The changes in this PR will be included in the next version bump.
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
Is this the right fix? Feels like maybe 405 is the wrong response for a GET
request with */*
if a page exists. Thoughts?
Is a test still TODO or is it basically impossable to test?
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.
Is this the right fix? Feels like maybe 405 is the wrong response for a
GET
request with*/*
if a page exists. Thoughts?
An alternative is to await the route.endpoint()
call earlier so we can check which methods it has but I'm not sure what kind of impact that will have. Either that, or prefer pages over endpoints during content negotiation (or earlier).
related to content negotiation https://github.com/sveltejs/kit/issues/11794
fixes https://github.com/sveltejs/kit/issues/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:
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