Skip to content

Fix trailing slash dropped when joining route segments - #10071

Draft
Timothee Guerin (timotheeguerin) with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-regression-http-1-10-1
Draft

Timothee Guerin (timotheeguerin) with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-regression-http-1-10-1

Conversation

Copilot AI commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Explicit trailing / on interface routes was being dropped when joined with child route segments starting with ? or :.

@route("{blobName}/")
interface Blobs {
  @put @route("?some-query=true")
  putBlob(blobName: string, @body content: bytes): void;
  // Expected:  /{blobName}/?some-query=true
  // Actual:    /{blobName}?some-query=true
}

Root cause: normalizeFragment unconditionally trimmed trailing / from all non-last segments, even when the next segment doesn't start with /.

Fix: Replace the blanket trimLast behavior with // deduplication at the join point — only strip a / when concatenation would produce a double slash.

Original prompt

This section details on the original issue you should resolve

<issue_title>Regression from http 1.10.1</issue_title>
<issue_description>Explicit / is now dropped when defined on interface.
When joining with parent routes we seem to drop an explicit trailing /. this feels quite like an edge case but this isn't expected

playground

@route("{blobName}/")
interface Blobs {
  // expected:  /{blobName}/?some-query=true
  // actual:  /{blobName}?some-query=true
  @put
  @route("?some-query=true")
  putBlob(blobName: string, @body content: bytes): void; 
}
```</issue_description>

<agent_instructions>The route joining algorithm should be smarter and not trim `/` if it is relevent. Only trim it if it would result in a `//` </agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 18, 2026 18:33
…t in double slash

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix regression from http 1.10.1 Fix trailing slash dropped when joining route segments Mar 18, 2026
@pkg-pr-new

pkg-pr-new Bot commented Mar 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http@10071

commit: 29c9ad7

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Apr 18, 2026
@timotheeguerin Timothee Guerin (timotheeguerin) removed the stale Mark a PR that hasn't been recently updated and will be closed. label Apr 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http
Show changes

@typespec/http - fix ✏️

Fix route joining to preserve trailing / when it would not result in //

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label May 29, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

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 stale label.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @Copilot. The PR will be closed since the PR has no update for 28 days. If this is still relevant please reopen.

@timotheeguerin Timothee Guerin (timotheeguerin) added the int:azure-specs Run integration tests against azure-rest-api-specs label Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

int:azure-specs Run integration tests against azure-rest-api-specs lib:http stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression from http 1.10.1

2 participants