Skip to content

Don't produce URL with "?" alone #706

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

Merged
merged 3 commits into from
Aug 7, 2025

Conversation

hongquan
Copy link
Contributor

When the searchParams is an empty project, ky still produce URL with question mark, like "/path?". It should be without "?".
This PR is to fix that.

@sholladay
Copy link
Collaborator

Is there a technical reason why this behavior is problematic for you or is it purely an aesthetic preference?

@hongquan
Copy link
Contributor Author

It is not problematic, just aesthetic preference.

@hongquan
Copy link
Contributor Author

hongquan commented Aug 7, 2025

Another concern is duplicate cache. Because the cache is identified by URL, these two URLs "/path?" and "/path" will make the browser (or proxy) to create two caches, even though they point to the same document. It is wasteful.

Copy link
Collaborator

@sholladay sholladay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't seem to have write access to this fork. Otherwise, I would've tweaked it myself and then merged it. LGTM other than the function name.

@sholladay sholladay merged commit 17ca389 into sindresorhus:main Aug 7, 2025
3 checks passed
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.

2 participants