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

Normalize letter cases in URL #3012

Closed
mik-jozef opened this issue Oct 29, 2019 · 1 comment
Closed

Normalize letter cases in URL #3012

mik-jozef opened this issue Oct 29, 2019 · 1 comment

Comments

@mik-jozef
Copy link

What problem does this feature solve?

If the user visits the URL /path/example/view, and a route /Path/Example/mode(View|Edit) is registered in the router, and router uses case insensitive matching, (and maybe if a flag is set on the route/globally), router should replace the current URL with /Path/Example/View.

Why: to have the best of both case sensitive and insensitive matching - a canonical URL for a single resource, users won't have to remember letter cases, and aesthetic preference of /Path/Example/View to /pAtH/eXaMpLe/ViEw.

What does the proposed API look like?

If this should be behind a flag, I see two ways to do that:

  1. A new boolean option, eg. normalizeLetterCases in RouteConfig interface, or
  2. Since 0. would be non-orthogonal with the caseSensitive option, they could be merged into a single letterCase option of type 'strict'|'normalize'|'ignore'
@posva
Copy link
Member

posva commented Oct 29, 2019

Unfortunately, there are quite a few edge cases we wouldn't be able to handle like properly changing params or being inflexible by always forcing an option and this being a very specific need that can be solved in user land by doing the needed string manipulation in an afterEach + replace, I would rather keep it that way

@posva posva closed this as completed Oct 29, 2019
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

No branches or pull requests

2 participants