Skip to content

Commit

Permalink
Remove trailing slash on instanceURL (#754)
Browse files Browse the repository at this point in the history
#722, @W-5622038@
  • Loading branch information
lcampos authored Nov 15, 2018
1 parent 49b4f08 commit 1fa1704
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ export class StreamingService {
systemEventClientInfo: StreamingClientInfo,
userEventClientInfo: StreamingClientInfo
): Promise<boolean> {
const urlElements = [requestService.instanceUrl, 'cometd', this.apiVersion];
const urlElements = [
this.removeTrailingSlashURL(requestService.instanceUrl),
'cometd',
this.apiVersion
];
const streamUrl = urlElements.join('/');

this.systemEventClient = new StreamingClient(
Expand All @@ -96,6 +100,10 @@ export class StreamingService {
return Promise.resolve(this.isReady());
}

private removeTrailingSlashURL(instanceUrl: string) {
return instanceUrl ? instanceUrl.replace(/\/+$/, '') : '';
}

public disconnect(): void {
if (this.systemEventClient) {
this.systemEventClient.disconnect();
Expand Down

0 comments on commit 1fa1704

Please sign in to comment.