fix(client): normalize root WebSocket URLs - #5291
Open
Ersaoktaviannn wants to merge 1 commit into
Open
Conversation
The index segment is a client-side alias for root routes. Apply the existing normalization before path parameter substitution so $ws() targets the declared endpoint while preserving dynamic values named index.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
indexalias before constructing WebSocket URLsindexBefore / after
client.index.$ws()for/ws://host/indexws://host/ws://host/api/indexws://host/api/:idwithid: "index"ws://host/indexImpact
indexis the client-side alias for a root route.$get(),$url(), and$path()already remove that synthetic segment, but$ws()did not. As a result, a typed WebSocket client for/attempted its handshake against/index(and a nested root against/api/index), which targets a different route and commonly returns404.Normalization runs before path parameter substitution, so a genuine dynamic value named
indexis not removed.Verification
npx vitest --run src/client/client.test.ts— 119 passednpx vitest --run src/client/types.test.ts --coverage.enabled=false— 13 passednpx tsc -p tsconfig.spec.json --pretty falsegit diff --checkon the changed filesThe author should do the following, if applicable