fix(client): keep a param value of "index" in $url() and $path() (#5297)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
removeIndexString() strips a trailing /index so that the synthetic .index accessor resolves to the route it aliases. In the $url()/$path() branch it ran after the params had been substituted, so anything that merely looked like the alias once substitution was done got stripped as well: client.docs[':page'].$path({ param: { page: 'index' } }) // "/docs" client.index[':v?'].$path({ param: { v: undefined } }) // "/" The second is a route with a literal /index segment; "/" does not match it and returns 404, so that URL never pointed at the route it came from. The alias belongs to the route template and neither of those does, so the strip now runs before substitution. ClientRequestImpl.fetch already does it in that order, which is why $get() has always returned the right path for these routes while $url() and $path() did not.
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+75 added−10 removed
- tests:+71 added−7 removed
- other:+4 added−3 removed