Fix url bug in the hooks documentation examples #4643
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In a hook
event.request.urlwill be a complete URL I believe (https://developer.mozilla.org/en-US/docs/Web/API/Request/url) meaningevent.request.url.startsWith('/custom')will never be true. This commit fixes that.Checklist boilerplate
I haven't bothered with this since it's such a small and hopefully non-controversial change.
N/A but I have tried out the old example and run into this issue and changing it fixes it
Tests
pnpm testand lint the project withpnpm lintandpnpm checkI couldn't get the project to build due to an error I was running into (Error building project - "Cannot find package 'cookie'" #4642) so I couldn't run these but since it's purely a docs change the code base shouldn't be impacted.
Changesets
pnpx changesetand following the prompts. All changesets should bepatchuntil SvelteKit 1.0N/A