Repository navigation
Fix trailing slash dropped when joining route segments - #10071
Timothee Guerin (timotheeguerin) with Copilot wants to merge 8 commits into
Conversation
…t in double slash Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
commit: |
|
All changed packages have been documented.
Show changes
|
|
Hi @Copilot. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the |
|
Hi @Copilot. The PR will be closed since the PR has no update for 28 days. If this is still relevant please reopen. |
There was a problem hiding this comment.
🟡 Changes recommended
Path-style expansions retain the parent route’s trailing slash, generating URLs such as /foo//42 and triggering double-slash warnings.
1 open issue
What changed in this PR
This PR fixes HTTP route joining so explicit trailing slashes are preserved before child routes beginning with ? or :.
Changes:
- Replaces unconditional trailing-slash trimming with slash deduplication at route boundaries.
- Adds regression tests for preserving parent-route trailing slashes.
- Adds a changelog entry for
@typespec/http.
| File | Description |
|---|---|
packages/http/test/routes.test.ts |
Tests trailing-slash preservation before ? and : child routes. |
packages/http/src/route.ts |
Changes route joining to deduplicate boundary slashes. |
.chronus/changes/copilot-fix-regression-http-1-10-1-2026-2-18-18-33-49.md |
Documents the HTTP route-joining fix. |
Review effort: Balanced
|
You can try these changes here
|
Mark Cowlishaw (markcowl)
left a comment
There was a problem hiding this comment.
I think the copilot review is fairly accurate - should also have a test validating the additional scenario

Explicit trailing
/on interface routes was being dropped when joined with child route segments starting with?or:.Root cause:
normalizeFragmentunconditionally trimmed trailing/from all non-last segments, even when the next segment doesn't start with/.Fix: Replace the blanket
trimLastbehavior with//deduplication at the join point — only strip a/when concatenation would produce a double slash.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.