Skip to content

Commit ff077cb

Browse files
feat: remove trailing slash
1 parent 9f70e14 commit ff077cb

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

js/src/sdk/client/core/OpenAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type OpenAPIConfig = {
3939
};
4040
};
4141

42-
export const COMPOSIO_BASE_URL = "https://backend.composio.dev/";
42+
export const COMPOSIO_BASE_URL = "https://backend.composio.dev";
4343

4444
export const OpenAPI: OpenAPIConfig = {
4545
BASE: COMPOSIO_BASE_URL,

js/src/sdk/models/backendClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { client as axiosClient } from "../client/services.gen";
44
import { setAxiosClientConfig } from "../utils/config";
55
import { CEG } from "../utils/error";
66
import { COMPOSIO_SDK_ERROR_CODES } from "../utils/errors/src/constants";
7+
import { removeTrailingSlashIfExists } from "../utils/string";
78

89
/**
910
* Class representing the details required to initialize and configure the API client.
@@ -35,7 +36,7 @@ export class BackendClient {
3536
constructor(apiKey: string, baseUrl: string, runtime?: string) {
3637
this.runtime = runtime || "";
3738
this.apiKey = apiKey;
38-
this.baseUrl = baseUrl;
39+
this.baseUrl = removeTrailingSlashIfExists(baseUrl);
3940
this.instance = axiosClient.instance;
4041

4142
if (!apiKey) {
@@ -84,7 +85,7 @@ export class BackendClient {
8485
*/
8586
private initializeApiClient() {
8687
axiosClient.setConfig({
87-
baseURL: this.baseUrl,
88+
baseURL: removeTrailingSlashIfExists(this.baseUrl),
8889
headers: {
8990
"X-API-KEY": `${this.apiKey}`,
9091
"X-SOURCE": "js_sdk",

js/src/sdk/utils/string.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const removeTrailingSlashIfExists = (str: string) => str.replace(/\/+$/, '');

0 commit comments

Comments
 (0)