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", () => {
8787 await transport . send ( message ) ;
8888
8989 // Verify the POST request maintains the custom path
90- expect ( lastServerRequest . url ) . toBe ( "/custom/path/messages " ) ;
90+ expect ( lastServerRequest . url ) . toBe ( "/custom/path/sse " ) ;
9191 } ) ;
9292
9393 it ( "handles multiple levels of custom paths" , async ( ) => {
@@ -107,7 +107,7 @@ describe("SSEClientTransport", () => {
107107 await transport . send ( message ) ;
108108
109109 // 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 " ) ;
111111 } ) ;
112112
113113 it ( "maintains custom path for SSE connection" , async ( ) => {
@@ -130,7 +130,7 @@ describe("SSEClientTransport", () => {
130130 } ;
131131
132132 await transport . send ( message ) ;
133- expect ( lastServerRequest . url ) . toBe ( "/custom/path/messages " ) ;
133+ expect ( lastServerRequest . url ) . toBe ( "/custom/path/sse " ) ;
134134 } ) ;
135135
136136 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 {
147147 this . _endpoint = new URL ( messageEvent . data , this . _url ) ;
148148
149149 // 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 ;
157151
158152 if ( this . _endpoint . origin !== this . _url . origin ) {
159153 throw new Error (
You can’t perform that action at this time.
0 commit comments