-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[fix] 1714 rest params in endpoint #2955
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
Conversation
🦋 Changeset detectedLatest commit: fae0950 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 |
if (/.+\[\.\.\.[^\]]+\]/.test(segment) || /\[\.\.\.[^\]]+\].+/.test(segment)) { | ||
if ( | ||
/.+\[\.\.\.[^\]]+\]/.test(segment) || | ||
(/\[\.\.\.[^\]]+\].+/.test(segment) && !/\[\.\.\.[^\]]+\]\.json$/.test(segment)) |
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 doubt we want a hard-coded check for [...rest].json.js
. .json
is a convention and it can be anything else by the user. Also, have you confirm with this change that a SvelteKit app still routes normally? I have a hunch there are other places to fix as well.
With that said, I'm not sure what's the path forward, or maybe we should stick with the issue workaround for now. I'll see if the others has an opinion on 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.
It might be good to make it more flexible in the future.
But there are strong reasons to implement that fix:
.json
is the framework convention for endpoints.json
is used in the example project- because of that we would create unnecessary friction for new users coming to the framework
Thank you. The answer is both simpler and more complicated than this — simpler in that we can just allow any rest segment to have a prefix/suffix (as I believe was the case with Sapper), and more complex in that we need to tweak the implementation a bit. Closing this in favour of #3240. |
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
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0