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: avoid running load function on invalid requests #9752

Merged
merged 15 commits into from Jul 4, 2023

Conversation

eltigerchino
Copy link
Member

@eltigerchino eltigerchino commented Apr 23, 2023

fixes #9217

Checks that the request method is either a GET, POST, or HEAD before attempting to render the page.

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. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Apr 23, 2023

🦋 Changeset detected

Latest commit: 7fb4544

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

@benmccann
Copy link
Member

I just noticed a blank line on line 329 of respond.js (which used to be line 327) while looking at this PR. Maybe you can remove it while you're editing the file

I feel like my brain is probably just malfunctioning at the moment and the answer will be obvious, but when would you use a POST instead of a GET to render a page? Is it something to do with content negotiation or progressive enhacement?

@eltigerchino
Copy link
Member Author

eltigerchino commented Apr 24, 2023

I just noticed a blank line on line 329 of respond.js (which used to be line 327) while looking at this PR. Maybe you can remove it while you're editing the file

Ah found it and removed it.

I feel like my brain is probably just malfunctioning at the moment and the answer will be obvious, but when would you use a POST instead of a GET to render a page? Is it something to do with content negotiation or progressive enhacement?

Yeah, the POST method is for those progressive enhancement / action requests.

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
@eltigerchino eltigerchino merged commit 67a0d86 into master Jul 4, 2023
14 checks passed
@eltigerchino eltigerchino deleted the fix-load-incorrectly-triggered branch July 4, 2023 13:10
@github-actions github-actions bot mentioned this pull request Jul 4, 2023
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.

OPTIONS http calls trigger loader functions
3 participants