URL lowercased with svelte-routing

Viewed 226

I'm rewriting a former SPA React app with Svelte. I'm using svelte-routing as a router and each time I enter an url in the browser address bar, the URL got lowercased. This causes me a problem because I need to catch URL-parameters with the original case. With the React version, I don't have this problem.

Is it a problem with the sirv/polka server which is used with Svelte or the problem may come from elsewere?

Thank you for any help.

1 Answers

Svelte-routing doesn’t seem to change the case of any part of url, so it might be a server problem.

I found a lengthy discussion about casing and url from stackoverflow. Basically one shouldn’t trust case-sensitivity in url ie. the saftest bet would be lower-case, because different servers handle casing differently.

Query parameters and values are more complicated. If I was a backend designer, I would make query parameters case-insensitive and values case-sensitive.

www.example.com/product?brand=Nike&color=black

Would be the same as

Www.EXAMPLE.Com/Product?BRAND=Nike&Color=black

But this wouldn’t be the same

www.example.com/product?brand=nike&color=Black

Although I would design my backend a little further and atleast a value of color would be handled as case-insensitive.

In short:
As a user you should never trust any part of the url, query parameters or values to be case-sensitive.
As a backend designer you should allow every part of url and query parameters to be case-insensitive. Query values should also be case-insensitive, if possible.

Related