fix: preserve custom paths in SSE endpoint URLs #466
+11
−0
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
When an SSE client connects with a custom path (e.g.,
/api/v1/custom/sse
), ensure the endpoint URL maintains the same base path structure but with/messages
instead of/sse
. This fixes issues where custom endpoints were getting collapsed to the root path.Problem
The SSE client was not preserving custom paths when constructing endpoint URLs. When a client connected to a server at a custom path like
/api/v1/custom/sse
, the endpoint URL would be constructed without preserving the custom path, resulting in POST requests being sent to/messages
instead of/api/v1/custom/messages
.Solution
Modified the endpoint event handler in the SSE client to:
/sse
suffix)/messages
suffixTesting
This PR makes the failing tests from #439 pass. The tests verify that:
Related Issues
Test Plan
🤖 Generated with Claude Code