fix sse endpoint path preservation
This commit is contained in:
parent
1fd6265751
commit
00cb9203cd
1 changed files with 4 additions and 10 deletions
|
|
@ -147,13 +147,7 @@ export class SSEClientTransport implements Transport {
|
|||
this._endpoint = new URL(messageEvent.data, this._url);
|
||||
|
||||
// If the original URL had a custom path, preserve it in the endpoint URL
|
||||
const originalPath = this._url.pathname;
|
||||
if (originalPath && originalPath !== '/' && originalPath !== '/sse') {
|
||||
// Extract the base path from the original URL (everything before the /sse suffix)
|
||||
const basePath = originalPath.replace(/\/sse$/, '');
|
||||
// The endpoint should use the same base path but with /messages instead of /sse
|
||||
this._endpoint.pathname = basePath + '/messages';
|
||||
}
|
||||
this._endpoint.pathname = this._url.pathname;
|
||||
|
||||
if (this._endpoint.origin !== this._url.origin) {
|
||||
throw new Error(
|
||||
|
|
|
|||
Loading…
Reference in a new issue