File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ describe("SSEClientTransport", () => {
87
87
await transport . send ( message ) ;
88
88
89
89
// Verify the POST request maintains the custom path
90
- expect ( lastServerRequest . url ) . toBe ( "/custom/path/messages " ) ;
90
+ expect ( lastServerRequest . url ) . toBe ( "/custom/path/sse " ) ;
91
91
} ) ;
92
92
93
93
it ( "handles multiple levels of custom paths" , async ( ) => {
@@ -107,7 +107,7 @@ describe("SSEClientTransport", () => {
107
107
await transport . send ( message ) ;
108
108
109
109
// Verify the POST request maintains the full custom path
110
- expect ( lastServerRequest . url ) . toBe ( "/api/v1/custom/deep/path/messages " ) ;
110
+ expect ( lastServerRequest . url ) . toBe ( "/api/v1/custom/deep/path/sse " ) ;
111
111
} ) ;
112
112
113
113
it ( "maintains custom path for SSE connection" , async ( ) => {
@@ -130,7 +130,7 @@ describe("SSEClientTransport", () => {
130
130
} ;
131
131
132
132
await transport . send ( message ) ;
133
- expect ( lastServerRequest . url ) . toBe ( "/custom/path/messages " ) ;
133
+ expect ( lastServerRequest . url ) . toBe ( "/custom/path/sse " ) ;
134
134
} ) ;
135
135
136
136
it ( "establishes SSE connection and receives endpoint" , async ( ) => {
Original file line number Diff line number Diff line change @@ -147,13 +147,7 @@ export class SSEClientTransport implements Transport {
147
147
this . _endpoint = new URL ( messageEvent . data , this . _url ) ;
148
148
149
149
// If the original URL had a custom path, preserve it in the endpoint URL
150
- const originalPath = this . _url . pathname ;
151
- if ( originalPath && originalPath !== '/' && originalPath !== '/sse' ) {
152
- // Extract the base path from the original URL (everything before the /sse suffix)
153
- const basePath = originalPath . replace ( / \/ s s e $ / , '' ) ;
154
- // The endpoint should use the same base path but with /messages instead of /sse
155
- this . _endpoint . pathname = basePath + '/messages' ;
156
- }
150
+ this . _endpoint . pathname = this . _url . pathname ;
157
151
158
152
if ( this . _endpoint . origin !== this . _url . origin ) {
159
153
throw new Error (
You can’t perform that action at this time.
0 commit comments